Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 4 years ago
parent
commit
0cea7e5985
4 changed files with 18 additions and 2 deletions
  1. 3 2
      app/controller/login_controller.js
  2. 5 0
      config/config.default.js
  3. 5 0
      config/config.local.js
  4. 5 0
      config/config.uat.js

+ 3 - 2
app/controller/login_controller.js

@@ -26,6 +26,7 @@ module.exports = app => {
                 ctx.redirect('/wap');
                 return;
             }
+
             const errorMessage = ctx.session.loginError;
             // 显示完删除
             ctx.session.loginError = null;
@@ -53,7 +54,7 @@ module.exports = app => {
         async wxAuth(ctx) {
             const code = ctx.query.code;
             try {
-                const client = new OAuth('wx5320cd30cecdbd68', 'ca7c0dbd9e94dc3b1c3b0e73865743f4');
+                const client = new OAuth(ctx.app.config.wxCode.appid, ctx.app.config.wxCode.appsecret);
                 const token = await client.getAccessToken(code);
                 // const user = await client.getUser(token.data.openid);
                 // console.log(user);
@@ -308,7 +309,7 @@ module.exports = app => {
                     ctx.redirect('/dashboard');
                 }
             } catch (error) {
-                this.log(error);
+                // this.log(error);
                 ctx.session.loginError = error;
             }
             const errorMessage = ctx.session.loginError;

+ 5 - 0
config/config.default.js

@@ -188,6 +188,11 @@ module.exports = appInfo => {
             payment: false, // enable or disable co-wechat-payment
         },
     };
+    // wx扫码登录
+    config.wxCode = {
+        appid: 'wx5320cd30cecdbd68',
+        appsecret: 'ca7c0dbd9e94dc3b1c3b0e73865743f4',
+    };
 
     config.proxy = true;
 

+ 5 - 0
config/config.local.js

@@ -83,6 +83,11 @@ module.exports = appInfo => {
         consoleLevel: 'WARN',
         disableConsoleAfterReady: false,
     };
+    // wx扫码登录
+    config.wxCode = {
+        appid: 'wx5320cd30cecdbd68',
+        appsecret: 'ca7c0dbd9e94dc3b1c3b0e73865743f4',
+    };
 
     config.is_debug = true;
 

+ 5 - 0
config/config.uat.js

@@ -53,6 +53,11 @@ module.exports = appInfo => {
         //renew: true, // session临近过期更新过期时间
         rolling: true, // 每次都更新session有效期
     };
+    // wx扫码登录
+    config.wxCode = {
+        appid: 'wx5320cd30cecdbd68',
+        appsecret: 'ca7c0dbd9e94dc3b1c3b0e73865743f4',
+    };
 
     return config;
 };