小程序进入调用订阅消息 wx.requestSubscribeMessage
var requestMsg=function () {
return new Promise((resolve, reject) => {
console.log(111)
wx.requestSubscribeMessage({
tmplIds: ["H6AUOLZu3cV1bbw","JcXTQM4"],
success: (res) => {
if (res['H6AUOLZuH9dbbw','JcXTQoPMyA4M4'] === 'accept'){
wx.showToast({
title: '订阅OK!',
duration: 1000,
success(data) {
//成功
resolve()
}
})
}
},
fail(err) {
//失败
console.error(err);
reject()
}
})
})
}
module.exports = {
requestMsg,
}