| | |
| | | } |
| | | |
| | | sendWxMessage = (verify, id) => { |
| | | let domain = '' |
| | | let domain = window.GLOB.baseurl |
| | | let appId = window.GLOB.WXAppID || '' |
| | | |
| | | if (verify.wxAppId && verify.wxAppId !== appId) { |
| | |
| | | appId = 'wx4d8a34c8d4494872' |
| | | } |
| | | |
| | | if (!window.GLOB.nginx && !domain) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'nginx服务尚未开启,不可发送模板消息。', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (!appId) { |
| | | if (!appId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未添加公众号ID,不可发送模板消息。', |
| | |
| | | return m |
| | | }) |
| | | |
| | | Api.wxAccessToken(appId, domain).then(res => { |
| | | if (!res.access_token) return |
| | | |
| | | // cgi-bin/message/template/send |
| | | params.forEach(n => { |
| | | Api.wxNginxRequest(`${domain}cgi-bin/message/template/send?access_token=${res.access_token}`, 'post', JSON.stringify(n)).then(re => { |
| | | Api.directRequest({ |
| | | url: domain + 'wechat/send?appid=' + appId, |
| | | method: 'post', |
| | | data: JSON.stringify(n) |
| | | }).then(re => { |
| | | if (verify.wxNoteCallback === 'true') { |
| | | let msg = re.errmsg || '' |
| | | |
| | |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | }) |