liuyu 4 years ago
parent
commit
185c6b2b29
3 changed files with 3 additions and 4 deletions
  1. 1 2
      app/controller/weixin.js
  2. 1 1
      app/router.js
  3. 1 1
      config/config.default.js

+ 1 - 2
app/controller/weixin.js

@@ -49,12 +49,11 @@ class WeixinController extends Controller {
     // TODO: 生成回调地址
     const { wxapi, authUrl = this.ctx.path } = this.app.config;
     const backUrl = encodeURI(`${this.app.config.baseUrl}${this.config.authUrl}?state=${state}`);
-    const to_uri = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wxapi.appid}&response_type=code&redirect_uri=${backUrl}&connect_redirect=1#wechat`;
+    const to_uri = `${wxapi.baseUrl}/api/auth?appid=${wxapi.appid}&response_type=code&redirect_uri=${backUrl}&connect_redirect=1#wechat`;
     console.log('url-->' + to_uri);
     this.ctx.redirect(to_uri);
   }
 
-
   // GET 认证回调
   async authBack({ code, state }) {
     // const { code, state, type, redirecturi } = this.ctx.query;

+ 1 - 1
app/router.js

@@ -47,7 +47,7 @@ module.exports = app => {
   router.post('/api/onlive/register', controller.roomuser.register);
 
   // 微信端访问地址
-  router.get('/api/onlive/wxchat', controller.weixin.auth); // 微信登录
+  router.get('/api/onlive/auth', controller.weixin.auth); // 微信登录
   // 微信端访问地址
   router.get('/api/onlive/wxchattest', controller.weixin.authTest); // 微信登录测试
 };

+ 1 - 1
config/config.default.js

@@ -48,7 +48,7 @@ module.exports = appInfo => {
   // 服务器发布路径
   config.baseUrl = 'https://zb.liaoningdoupo.com';
   // 认证回调地址
-  config.authUrl = '/api/onlive/wxchat';
+  config.authUrl = '/api/onlive/auth';
 
   // 直播appid与key
   config.sdkappid = 1400380125;