|
|
@ -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); |
|
|
|