不管我放什么openid,放几个就发几遍给我自己是什么情况?
sendMsg: function () {
let users = [
"o6gY35UIf7",
"o6gY35eNp"
]
users.forEach(item => {
console.log(item)
wx.cloud.callFunction({
name: 'sendMsg',
data: {
openid: item,
title: title,
time: time,
member: member,
place: place,
remarks: remarks
},
success: res => {
console.log(res)
},
fail: err => {
console.log(err)
}
})
})
云函数代码:
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
const {
OPENID
} = cloud.getWXContext()
try {
const result = await cloud.openapi.subscribeMessage.send({
touser: event.openid,
page: 'pages/index/index',
templateId: "mv1AiOjD9ljPoaiFToRtIdZeW4T7uU8CTZLNBWdPNCQ",
data: {
thing1: {
value: event.title
},
time3: {
value: event.time
},
thing4: {
value: event.member
},
thing5: {
value: event.place
},
thing7: {
value: event.remarks
}
}
})
return result
} catch (err) {
console.log(err)
return err
}
}
云函数里openid写死了吧 代码没更新