处理传值异常

This commit is contained in:
aixianling
2024-10-18 10:16:02 +08:00
parent cc34a5cdea
commit c0a849cb9f

View File

@@ -62,16 +62,15 @@ const handleZip = (id, ws) => {
const progress = new counter(`正在处理 ${info.name} 的打包工作...`) const progress = new counter(`正在处理 ${info.name} 的打包工作...`)
if (info.type == 'web') { if (info.type == 'web') {
const {name, version, dist} = info const {name, version, dist} = info
const deploy = dist?.trim() || `${name}_v${version}` const deploy = dist?.trim() || `${name}v${version}`
const buildConfig = { const buildConfig = {
web: {task: "devops-web", token: 'fLeOGSVIRs405Me'}, web: {task: "devops-web", token: 'fLeOGSVIRs405Me'},
}[info.type] }[info.type]
startUpdateSql() startUpdateSql()
.then(() => progress.set(30, id)) .then(() => progress.set(30, id))
.then(() => fse.emptyDir(dist || `../zips/${deploy}`)) .then(() => fse.emptyDir(dist || `../zips/${deploy}`))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, .then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, {params: {token: buildConfig.token, pid: id, dist:deploy}}))
{params: {token: buildConfig.token, pid: id, deploy}})) .then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => res.data?.id || 1))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => res.data?.lastBuild.number || 1))
.then(currentJob => new Promise((resolve, reject) => { .then(currentJob => new Promise((resolve, reject) => {
jobs[id] = {task: buildConfig.task, build: currentJob} jobs[id] = {task: buildConfig.task, build: currentJob}
const timer = setInterval(() => { const timer = setInterval(() => {
@@ -126,7 +125,6 @@ const handleZip = (id, ws) => {
console.log(err) console.log(err)
}) })
} }
module.exports = { module.exports = {
action: "/custom/getZip", execute: (ws, request) => { action: "/custom/getZip", execute: (ws, request) => {
const {id, cid} = request const {id, cid} = request