lrf402788946 4 jaren geleden
bovenliggende
commit
63f38424dc
3 gewijzigde bestanden met toevoegingen van 6 en 4 verwijderingen
  1. 4 2
      app/service/weixin.js
  2. 1 1
      config/config.default.js
  3. 1 1
      config/config.prod.js

+ 4 - 2
app/service/weixin.js

@@ -190,7 +190,8 @@ class WeixinAuthService extends AxiosService {
 
   // 发送微信模板消息
   async sendTemplateMsg(templateid, openid, first, keyword1, keyword2, remark, tourl) {
-    const url = this.ctx.app.config.sendDirMq + this.ctx.app.config.appid;
+    const { wxapi } = this.ctx.app.config;
+    const url = wxapi.sendDirMq + wxapi.appid;
     let _url = '';
     if (tourl) {
       // 通过openid取得用户基本信息
@@ -238,7 +239,8 @@ class WeixinAuthService extends AxiosService {
 
   // 发送微信模板消息自定义消息
   async sendTemplateDesign(templateid, openid, first, keyword1, keyword2, remark, tourl) {
-    const url = this.ctx.app.config.sendDirMq + this.ctx.app.config.appid;
+    const { wxapi } = this.ctx.app.config;
+    const url = wxapi.sendDirMq + wxapi.appid;
     const requestData = { // 发送模板消息的数据
       touser: openid,
       template_id: templateid,

+ 1 - 1
config/config.default.js

@@ -47,6 +47,7 @@ module.exports = appInfo => {
     mchkey: '1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9', // 商户key
     wxurl: 'http://free.liaoningdoupo.com/api/wxpayback',
     payurl: 'https://api.mch.weixin.qq.com/pay/unifiedorder',
+    sendDirMq: 'http://wx.cc-lotus.info/api.weixin.qq.com/cgi-bin/message/template/send?appid=',
   };
 
   config.proxy = true;
@@ -60,7 +61,6 @@ module.exports = appInfo => {
   config.redirect_uri_doctor = `${config.baseUrl}/patient/manage`;
   config.redirect_uri_patient = `${config.baseUrl}/doctor/manage`;
   // base路径
-  config.sendDirMq = 'http://wx.cc-lotus.info/api.weixin.qq.com/cgi-bin/message/template/send?appid=';
   // appID
   config.appid = 'wxdf3ed83c095be97a';
   config.REVIEW_TEMPLATE_ID = 'oqmozBcdkCzBOvNrdzMQ1lDJcobD5uBEpNoLWec0bPY';

+ 1 - 1
config/config.prod.js

@@ -15,6 +15,7 @@ module.exports = () => {
     mchkey: '1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9', // 商户key
     wxurl: 'http://jytz.jilinjobs.cn/api/wxpayback',
     payurl: 'https://api.mch.weixin.qq.com/pay/unifiedorder',
+    sendDirMq: 'http://www.jilinjobswx.cn/api.weixin.qq.com/cgi-bin/message/template/send?appid=',
   };
 
   // 服务器发布路径
@@ -22,7 +23,6 @@ module.exports = () => {
   // 认证回调地址
   config.authUrl = '/api/train/auth';
   // 消息模板
-  config.sendDirMq = 'http://www.jilinjobswx.cn/api.weixin.qq.com/cgi-bin/message/template/send?appid=';
 
   // mongoose config
   config.mongoose = {