请问解决了吗。。。
模板消息包含中文时报47001后台业务代码如下(文件编码是UTF-8): -------------------------------------------------------------------------------- var ctmntyoptions = { hostname: 'api.weixin.qq.com', path: '', method: 'POST', headers: { 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '' } } const SendTemplateMsgToCustomer = (_acctoken, notifyparams) => { return new Promise(function (resolve) { ctmntyoptions.path = strCtmNotifyPath + _acctoken let strparams = JSON.stringify(notifyparams) ctmntyoptions.headers['Content-Length'] = strparams.length var notifyreq = https.request(ctmntyoptions, function (notifyres) { var _notifyrtn = '' notifyres.on('data', function (_rtndata) { _notifyrtn += _rtndata }) notifyres.on('end', function () { let _rtndata = JSON.parse(_notifyrtn) if (_rtndata && 'errcode' in _rtndata) { if (_rtndata.errcode === 0) { resolve(true) } else { resolve(false) } } else { resolve(false) } }) }) notifyreq.on('error', (e) => { console.log('Send template msg request fail', e) }) notifyreq.write(strparams) notifyreq.end() }) } -------------------------------------------------------------------------------- 日志数据: {"touser":"oRuoC0ZwC6QPNcdyr9A********","template_id":"Fbn5W7r1fo2cwbhIl2M5*******","form_id":"wx20171114101441532f5fbfe508990*****","data":{"keyword1":{"value":"20171114082329*****10101"},"keyword2":{"value":"2017年11月14日 10:14:46"},"keyword3":{"value":"总部"},"keyword4":{"value":"0.2 元"},"keyword5":{"value":null}}} 返回数据: {"errcode":47001,"errmsg":"data format error hint: [zwWEQA0687ge21]"} 当模板数据里包含中文时,就返回47001,发送不成功。 但是当我把中文去掉,模板消息就能发送成功。
2021-05-31补充一下调用接口: https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=45_D7E39wX9MCa9sItm86DVai8QyXQiA5mS-ZQ5sqaVUUHsMaIsVC4JxR3h8KMI0Yy7y3gxaHAxVS3qVqHRRDlG3ay9NeLylIXj2uJMwErjRargypoJXiyCeXmo8QiUcHpW5eY91DM1LV*******
模板消息发送报错47001 data format error.....?调试了半天,也看了很多问题贴,还是看不出问题在哪—— { touser: 'oTLp45MzcxCs76********BR0c', template_id: 'FT84NGG-J81MKvpqmdKvhaiXpya********SvxJU', miniprogram: { appid: 'wx743******0f4a618c', pagepath: '/pages/guest/detail/index?code=525558&selfFlag=0' }, data: { first: { value: '您预约的访客已进入', color: '#173177' }, keyword1: { value: '外卖', color: '#173177' }, keyword2: { value: '同意进入', color: '#173177' }, keyword3: { value: '2021-05-29|14:50:17', color: '#173177' }, remark: { value: '点击可查看详情', color: '#173177' } } }
2021-05-29顺便再问一个关于组件的问题,我想使用组件property接收的属性做进一步的处理,但是在lifetimes的ready和attached生命周期函数都只能拿到property的初始值。。。是否只能通过ovservers监听才能实现? [图片]
自定义组件内部无法使用wx.navigateTo跳转?针对扫码封装了一个自定义的组件,扫到指定内容之后会跳转到对应的页面,但是每次执行wx.navigateTo都会报错。。。 [图片]
2021-04-02