微信小程序报错47001
- 47001 data format error
- 请求的head必须是application/json不能是urlencode
var sendMsg = await wepy.request({
url: `https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=你的access_token`,
method: 'POST',
header: { 'content-type': 'application/json' },
data: {
touser: openid,
template_id: '模板id在控制台获取',
page: 'pages/setting/manage-address-page',
form_id: prepay_id,
data: {
keyword1: '123',
keyword2: 'LION '
}
}
})
小程序报错41028
- 原因是必须要在真机上测试, 不能用微信开发工具测试
微信小程序通知
var access_token = await wepy.request({
url: `https:
method: 'GET',
header: { 'content-type': 'application/json' }
})
var sendMsg = await wepy.request({
url: `https:
.data.access_token}`,
method: 'POST',
header: { 'content-type': 'application/json' },
data: {
touser: openid,
template_id: '微信控制台配置的模板id, 模板通常有支付成功等',
page: 'pages/index',
form_id: prepay_id,
data: {
keyword1: '123',
keyword2: 'LION 狮王 CLINICA ADVANTAGE防蛀立式牙膏 柑橘薄荷型'
}
}
})