fix(store): 修复订阅消息模板ID并完善失败处理逻辑
- 更新订阅消息模板ID为新的有效值 - 在订阅失败回调中对错误码进行细化处理 - 对模板ID不存在或未绑定场景弹出提示模态框 - 对用户拒绝订阅或关闭权限静默展示取消通知 - 添加失败日志打印,便于问题排查
This commit is contained in:
@@ -36,7 +36,7 @@ const FEATURE_CARDS = [
|
||||
|
||||
// 订阅消息模板 ID
|
||||
const SUBSCRIBE_TMPL_IDS = [
|
||||
'sh1K9iK7vZjebUNFu6OsMsnsJxm4whThWGrhN7I4zVg', // 交易提醒:订单号、商品名称、联系人、联系电话、送货地址
|
||||
'RpZaVfxTuNxRmUxvinAwk6FHTpjV9yTznShdy8OHiTk', // 交易提醒:订单号、商品名称、联系人、联系电话、送货地址
|
||||
]
|
||||
|
||||
export default function StoreCenterPage() {
|
||||
@@ -102,8 +102,19 @@ export default function StoreCenterPage() {
|
||||
Taro.showToast({ title: '订阅成功', icon: 'success' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
fail: (err: any) => {
|
||||
console.error('订阅失败:', err)
|
||||
// errCode 20001: 模板ID不存在或未绑定到当前小程序
|
||||
if (err.errCode === 20001) {
|
||||
Taro.showModal({
|
||||
title: '订阅模板未配置',
|
||||
content: '请联系管理员在微信公众平台选用「新订单通知」订阅消息模板',
|
||||
showCancel: false,
|
||||
})
|
||||
} else if (err.errCode === 20004 || err.errCode === 20002) {
|
||||
// 用户拒绝/关闭了主开关,静默处理
|
||||
Taro.showToast({ title: '已取消订阅', icon: 'none' })
|
||||
}
|
||||
},
|
||||
})
|
||||
}, [])
|
||||
|
||||
Reference in New Issue
Block a user