wx.requestSubscribeMessage({
tmplIds: config.templateIds,
success: (res) => {
console.log(res);
if (res[config.templateIds] == 'reject') {
wx.showModal({
title: '温馨提示',
content: "您已关闭消息推送,如需要消息推送服务,请点击确定跳转设置页面打开授权后再次尝试。",
success: function(modal) {
if (modal.confirm) {
wx.openSetting({ withSubscriptions: true })
}
}
})
}
},
fail: res => {
console.log("fail:", res);
if (res.errCode == '20004') {
wx.showModal({
title: '温馨提示',
content: "您的消息订阅主开关已关闭,如需要消息推送服务,请点击确定跳转设置页面打开授权后再次尝试。",
success: function(modal) {
if (modal.confirm) {
wx.openSetting({ withSubscriptions: true })
}
}
})
}
},
complete: res => {
}
});
让用户手动打开接收
参考链接:https://developers.weixin.qq.com/community/develop/doc/0000c45a5d06405cac7ed0c0656c00?_at=1680488124178