2.错误代码:_订阅失败 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 063184d2-56ce-474d-83f2-2349b16d26f2, cloud function service error code -504002, error message TypeError: Do not know how to serialize a BigInt
3.我的代码如下:
调用云函数的JS:
tuisong() {
console.log(this.data.rec)
var item = {
"time1": {
"value": this.dateFormat(this.data.rec[1].cdate)
},
"thing2": {
"value": this.data.rec[1].line
},
"thing3": {
"value": this.data.rec[1].postion
},
"thing4": {
"value": this.data.rec[1].status
}
}
wx.requestSubscribeMessage({
tmplIds: ['R88OQ7kzfTRYe0yFXbdtz_gtPQtlPGc-bt9V-TzQAZE'], //这里填入我们生成的模板id
success: res => {
if (res.errMsg === 'requestSubscribeMessage:ok') {
console.log('授权成功', res)
wx.cloud.callFunction({
name: 'getopenid',
}).then(res=>{
console.log('当前OPENID是',res.result.openid)
this.setData({
openid:res.result.openid
})
wx.cloud.callFunction({
name: 'send',
data: {
data: item,
openid: this.data.openid,
templateId: 'R88OQ7kzfTRYe0yFXbdtz_gtPQtlPGc-bt9V-TzQAZE',
}}).then(res=>{
console.log('订阅成功', res)
})
.catch(res=>{
console.log('订阅失败', res)
})
})
}
},
fail: res => {
console.log('授权失败', res)
}
})
},
getopenid云函数:
const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
return {
event,
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
}
}
send云函数:
```javascript
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})
exports.main = async (event, context) => {
return cloud.openapi.subscribeMessage.send({
touser: event.openid,
page: 'pages/query/index/index',
data: event.data,
templateId: event.templateId,
})
};
云函数 的问题 TypeError:不知道如何序列化BigInt