lanjianrong 3 gadi atpakaļ
vecāks
revīzija
bbcd0f5d83

+ 3 - 3
app/controller/login_controller.js

@@ -444,8 +444,8 @@ module.exports = app => {
               }
                 const result = await ctx.service.project.verifyManagementProject(ctx.helper.createJWT({ code }));
                 const token = ctx.helper.createJWT({ code, account })
-                const redirect = `${app.config.env === 'local' ? 'http://pmqa.smartcost.com.cn/auth' : 'http://pm.6jlzf.cn/auth'}?token=${token}`
-                response.data = { ...result, is_admin: ctx.session.sessionUser.account === ctx.session.sessionProject.userAccount, redirect};
+                const redirect = `${app.config.managementPath}/auth?token=${token}`
+                response.data = { ...result, is_admin: ctx.session.sessionUser.account === ctx.session.sessionProject.userAccount, redirect, env: app.config.env};
             } catch (error) {
                 response.code = -1;
                 response.msg = error.toString();
@@ -471,7 +471,7 @@ module.exports = app => {
               const { code = -1, data: { token = ''} = { token: ''}, msg = '请求失败' } = result
               if ( code === 0 && token) {
                 response.data = {
-                  redirect: `${app.config.env === 'prod' ? 'http://pmqa.smartcost.com.cn' : 'http://pm.6jlzf.cn'}?token=${token}`
+                  redirect: `${app.config.managementPath}/auth?token=${token}`,
                 }
               } else {
                 throw new Error(msg)

+ 2 - 2
app/service/project.js

@@ -199,7 +199,7 @@ module.exports = app => {
          */
         verifyManagementProject(token) {
             return new Promise((resolve, reject) => {
-                this.ctx.curl(`${app.config.env === 'prod' ? 'http://pm.6jlzf.cn' : 'http://192.168.1.76:2020'}/api/external/jl/calibration`, {
+                this.ctx.curl(`${app.config.managementProxyPath}/api/external/jl/calibration`, {
                     method: 'POST',
                     // dateType: 'json',
                     encoding: 'utf8',
@@ -227,7 +227,7 @@ module.exports = app => {
         async addProjectFromManagement() {
             const token = this.ctx.helper.createJWT({ account: this.ctx.session.sessionUser.account, code: this.ctx.session.sessionProject.code });
             return new Promise((resolve, reject) => {
-                this.ctx.curl(`${app.config.env === 'prod' ? 'http://pm.6jlzf.cn' : 'http://192.168.1.76:2020'}/api/external/jl/project/add`, {
+                this.ctx.curl(`${app.config.managementProxyPath}/api/external/jl/project/add`, {
                     method: 'POST',
                     encoding: 'utf8',
                     data: { token },

+ 3 - 0
config/config.default.js

@@ -224,5 +224,8 @@ module.exports = appInfo => {
 
     config.syncUrl = 'http://sync.jl.smartcost.com.cn/';
 
+    // 项目管理跳转路径
+    config.managementPath = 'http://pm.6jlzf.cn';
+    config.managementProxyPath = 'http://pm.6jlzf.cn';
     return config;
 };

+ 3 - 0
config/config.local.js

@@ -116,5 +116,8 @@ module.exports = appInfo => {
 
     config.is_debug = true;
 
+    // 项目管理跳转路径
+    config.managementPath = 'http://pmqa.smartcost.com.cn';
+    config.managementProxyPath = 'http://192.168.1.76:2020';
     return config;
 };

+ 3 - 0
config/config.qa.js

@@ -78,5 +78,8 @@ module.exports = appInfo => {
 
     config.is_debug = true;
 
+    // 项目管理跳转路径
+    config.managementPath = 'http://pmqa.smartcost.com.cn';
+    config.managementProxyPath = 'http://192.168.1.76:2020';
     return config;
 };

+ 3 - 0
config/config.test.js

@@ -54,5 +54,8 @@ module.exports = appInfo => {
         disableConsoleAfterReady: false,
     };
 
+    // 项目管理跳转路径
+    config.managementPath = 'http://pmqa.smartcost.com.cn';
+    config.managementProxyPath = 'http://192.168.1.76:2020';
     return config;
 };

+ 3 - 0
config/config.uat.js

@@ -81,5 +81,8 @@ module.exports = appInfo => {
 
     config.syncUrl = 'http://sync.jluat.smartcost.com.cn/';
 
+    // 项目管理跳转路径
+    config.managementPath = 'http://pmqa.smartcost.com.cn';
+    config.managementProxyPath = 'http://192.168.1.76:2020';
     return config;
 };