老师这个错误不知道怎么改 ID检查了也没有错
//错误码
VM104:1 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 6bf459cb-4d6e-11ea-82f5-5254007aa7a1, cloud function service error code -504002, error message errCode: 40037 | errMsg: openapi.templateMessage.send:fail invalid template_id hint: [uGHDRA07243932]
Error: errCode: 40037 | errMsg: openapi.templateMessage.send:fail invalid template_id hint: [uGHDRA07243932]
//错误原因
40037 订阅模板id为空不正确
//云函数
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.templateMessage.send({
touser: cloud.getWXContext().OPENID, // 通过 getWXContext 获取 OPENID
page: `/pages/blog-comment/blog-comment?blogId=${event.blogId}`,
data: {
thing2: {
value: event.content
},
time4: {
value: event.createTime
},
},
templateId:'HQ_Jsw3hlgXoR1B7gqG2q_I51ot6watfHful90Q1LkQ',
})
// result 结构
// { errCode: 0, errMsg: 'openapi.templateMessage.send:ok' }
return result
} catch (err) {
// 错误处理
// err.errCode !== 0
throw err
}
}