楼主解决了吗
发送订阅消息报erroCode:604100// 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init({ env:"campusapp-tbke2" }) cloud.init() // 云函数入口函数 //某人接收后给用户推送消息 exports.main = async (event, context) => { let date=new Date(); try{ const result = await cloud.openapi.subscribMessage.send({ touser:event.openid, page:'pages/mine/mine', data:{ thing1:{ value:'有人替你跑腿啦!!!' }, date2:{ value:date }, thing3:{ value:'电话:'+event.phone }, thing4:{ value:'请随时注意跑腿动态' } }, templateId:'Cca3spIn4kIIRs8rSBuZgWMO4WWw0GYL1gKkfQ-qNb0' }) console.log(result) return result; }catch(err){ return err } } 前端代码: //发送订阅消息 wx.cloud.callFunction({ name:'sendmsg', data:{ openid:o_id._openid, phone:that.data.myphone },success:function(res){ console.log("send msg successfully") console.log(res); },fail:function(res){ console.log("fail!!!") } })
2021-04-13