From e394e4d2baa69f6bc4d2d419c0076e40cff47542 Mon Sep 17 00:00:00 2001 From: aixianling Date: Fri, 18 Oct 2024 09:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=B7=AF=E5=BE=84=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=8E=B7=E5=8F=96=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/websocket/custom/getZip.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/websocket/custom/getZip.js b/src/websocket/custom/getZip.js index 84a0024..ddd38cd 100644 --- a/src/websocket/custom/getZip.js +++ b/src/websocket/custom/getZip.js @@ -61,7 +61,8 @@ const handleZip = (id, ws) => { const {signal} = controller; const progress = new counter(`正在处理 ${info.name} 的打包工作...`) if (info.type == 'web') { - const {name, version, dist = `${name}_v${version}`} = info + let {name, version, dist} = info + dist = dist?.trim() || `${name}_v${version}` const buildConfig = { web: {task: "devops-web", token: 'fLeOGSVIRs405Me'}, }[info.type] @@ -69,7 +70,7 @@ const handleZip = (id, ws) => { .then(() => progress.set(30, id)) .then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, {params: {token: buildConfig.token, pid: id, dist}})) - .then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => res.data.lastBuild.number)) + .then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => res.data?.lastBuild.number||1)) .then(currentJob => new Promise((resolve, reject) => { jobs[id] = {task: buildConfig.task, build: currentJob} const timer = setInterval(() => { @@ -77,10 +78,10 @@ const handleZip = (id, ws) => { if (res.data.result == 'SUCCESS') { clearInterval(timer) resolve(endUpdateSql()) - } else if (res.data.res == 'ABORTED') { + } else if (res.data.result == 'ABORTED') { clearInterval(timer) reject("构建取消") - } else if (res.data.res == 'FAILURE') { + } else if (res.data.result == 'FAILURE') { clearInterval(timer) reject("构建失败") }