Browse Source

禅道域名可配置:固定 -> 改为:环境变量。(原因:商用环境域名之间访问不通)

master
Julin 1 year ago
parent
commit
2be60417de
  1. 12
      web/config.js
  2. 18
      web/routes/missionboard/index.js

12
web/config.js

@ -23,6 +23,7 @@ const ANXINCLOUD_QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RES
const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || 'http://test.resources.anxinyun.cn';
const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn;
// const FS_FM_API = process.env.FS_FM_API || flags.fmUrl;
const ZENTAO_DOMAIN = process.env.ZENTAO_DOMAIN || 'https://pms.anxinyun.cn';
// if (!FS_UNIAPP_API) {
// console.log('缺少启动参数,异常退出');
@ -44,7 +45,7 @@ const product = {
opts: {
host: QINIU_DOMAIN_QNDMN_RESOURCE,
match: /^\/_file-server\//,
}
},
},
{
entry: require('./routes').entry,
@ -54,8 +55,9 @@ const product = {
qndmn: QINIU_DOMAIN_QNDMN_RESOURCE,
qiniu: {
fetchUrl: '/_file-server',
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE,
},
zentaoDomain: ZENTAO_DOMAIN,
},
},
{
@ -65,11 +67,11 @@ const product = {
accessKey: ANXINCLOUD_QINIU_ACCESSKEY,
secretKey: ANXINCLOUD_QINIU_SECRETKEY,
bucket: ANXINCLOUD_QINIU_BUCKET_RESOURCE,
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE,
},
maxSize: 10485760 * 10, // 100M
uploadPath: 'conmfortable-home'
}
uploadPath: 'conmfortable-home',
},
},
{
entry: require('./client').entry, // 静态信息

18
web/routes/missionboard/index.js

@ -5,13 +5,15 @@ const Holiday = require('../holiday');
module.exports = {
entry(app, router, opts) {
const ZENTAO_DOMAIN = opts.zentaoDomain;
async function auth() {
const session = await request.get('https://pms.anxinyun.cn/api-getSessionID.json');
const session = await request.get(`${ZENTAO_DOMAIN}/api-getSessionID.json`);
const sessionData = JSON.parse(session.text).data;
const { sessionName, sessionID } = JSON.parse(sessionData);
const loginInfo = await request
.post('https://pms.anxinyun.cn/user-login.json')
.post(`${ZENTAO_DOMAIN}/user-login.json`)
.set({ 'Content-Type': 'application/x-www-form-urlencoded' })
.query({ [`${sessionName}`]: sessionID })
.send({ account: 'admin', password: 'Fashion123' });
@ -53,7 +55,7 @@ module.exports = {
const { sessionName, sessionID } = app.fs.session;
const executionDetailRes = await request
.get(`https://pms.anxinyun.cn/execution-view-${executionId}.json`)
.get(`${ZENTAO_DOMAIN}/execution-view-${executionId}.json`)
.set('Cookie', `${sessionName}=${sessionID}`);
const executionDetailText = JSON.parse(executionDetailRes.text);
const executionDetailData = JSON.parse(executionDetailText.data);
@ -73,7 +75,7 @@ module.exports = {
const { sessionName, sessionID } = app.fs.session;
const testTaskRes = await request
.get(`https://pms.anxinyun.cn/execution-testtask-${executionId}.json`)
.get(`${ZENTAO_DOMAIN}/execution-testtask-${executionId}.json`)
.set('Cookie', `${sessionName}=${sessionID}`);
const testTaskText = JSON.parse(testTaskRes.text);
@ -134,7 +136,7 @@ module.exports = {
const executions = [];
// 执行(未开始)
const waitExecutionBaseURL = 'https://pms.anxinyun.cn/execution-all-wait-0-order_asc-0.json';
const waitExecutionBaseURL = `${ZENTAO_DOMAIN}/execution-all-wait-0-order_asc-0.json`;
const waitExecutionStats = await getExecutionStats('month', waitExecutionBaseURL, 200);
for (const item of waitExecutionStats) {
const { id, name, end } = item;
@ -151,7 +153,7 @@ module.exports = {
}
// 执行(进行中)
const doingExecutionBaseURL = 'https://pms.anxinyun.cn/execution-all-doing-0-order_asc-0.json';
const doingExecutionBaseURL = `${ZENTAO_DOMAIN}/execution-all-doing-0-order_asc-0.json`;
const doingExecutionStats = await getExecutionStats('month', doingExecutionBaseURL, 200);
for (const item of doingExecutionStats) {
const { id, name, end } = item;
@ -191,11 +193,11 @@ module.exports = {
const lastDayOfWeek = currentDate.clone().endOf('isoWeek');
// 执行(未开始)
const waitExecutionBaseURL = 'https://pms.anxinyun.cn/execution-all-wait-0-order_asc-0.json';
const waitExecutionBaseURL = `${ZENTAO_DOMAIN}/execution-all-wait-0-order_asc-0.json`;
const waitExecutionStats = await getExecutionStats('week', waitExecutionBaseURL, 200);
// 执行(进行中)
const doingExecutionBaseURL = 'https://pms.anxinyun.cn/execution-all-doing-0-order_asc-0.json';
const doingExecutionBaseURL = `${ZENTAO_DOMAIN}/execution-all-doing-0-order_asc-0.json`;
const doingExecutionStats = await getExecutionStats('week', doingExecutionBaseURL, 200);
const executionAll = waitExecutionStats.concat(doingExecutionStats);

Loading…
Cancel
Save