Skip to content

Commit 75f69f7

Browse files
committed
feat: add subscribe id
1 parent 8cf2b17 commit 75f69f7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

miniprogram/pages/my/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ Page({
4848
},
4949

5050
handleSubscribe() {
51-
const tmpId = 'vjEDlUYrVJ05CauSw_V9jIWF-okt3OMCBtlz9yvjrfg';
51+
const tmplIds = ['vjEDlUYrVJ05CauSw_V9jIWF-okt3OMCBtlz9yvjrfg', 'Sbtj4X4gIKWRy0xDeWU8xCl8LejbTpIQ3gWiKh5JFp4'];
5252
wx.requestSubscribeMessage({
53-
tmplIds: [tmpId],
54-
success: (res) => {
53+
tmplIds,
54+
success: async (res) => {
55+
const accept = tmplIds.some(key => res[key] === 'accept')
5556
Toast({
5657
context: this,
5758
selector: '#t-toast',
58-
message: res[tmpId] == 'accept' ? '订阅成功' : '你拒绝了订阅',
59+
message: accept ? '订阅成功' : '你拒绝了订阅',
5960
});
6061
}
6162
})

0 commit comments

Comments
 (0)