调整ws返回格式
This commit is contained in:
@@ -17,23 +17,23 @@ const handleZip = (id, ws) => {
|
|||||||
}, 6000)
|
}, 6000)
|
||||||
}
|
}
|
||||||
|
|
||||||
set(progress, remark) {
|
set(progress, id) {
|
||||||
if (this.timer) clearInterval(this.timer)
|
if (this.timer) clearInterval(this.timer)
|
||||||
this.count = progress
|
this.count = progress
|
||||||
sendMessage({code: 0, progress: this.count, remark})
|
sendMessage({code: 0, progress: this.count, id})
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
sendMessage({code: 0, progress: ++this.count, remark})
|
sendMessage({code: 0, progress: ++this.count, id})
|
||||||
}, 4000)
|
}, 4000)
|
||||||
}
|
}
|
||||||
|
|
||||||
stop(row) {
|
stop(row) {
|
||||||
if (this.timer) clearInterval(this.timer)
|
if (this.timer) clearInterval(this.timer)
|
||||||
sendMessage({code: 1, row})
|
sendMessage({code: 1, row, id: row.id})
|
||||||
}
|
}
|
||||||
|
|
||||||
finish(row) {
|
finish(row) {
|
||||||
if (this.timer) clearInterval(this.timer)
|
if (this.timer) clearInterval(this.timer)
|
||||||
sendMessage({code: 0, progress: 100, row})
|
sendMessage({code: 0, progress: 100, row, id: row.id})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,12 +47,12 @@ const handleZip = (id, ws) => {
|
|||||||
let path = `../${buildPath}`, {dist} = info
|
let path = `../${buildPath}`, {dist} = info
|
||||||
dist = dist || `../zips/${info.name}v${info.version || "1.0.0"}`
|
dist = dist || `../zips/${info.name}v${info.version || "1.0.0"}`
|
||||||
Promise.all([db.query(`update node_custom_config set download=null,error=null,zipTime='${dayjs().format("YYYY-MM-DD HH:mm:ss")}' where ${uniCon}`), execute(`./shell/update.sh ${info.name} ${path}`, signal)])
|
Promise.all([db.query(`update node_custom_config set download=null,error=null,zipTime='${dayjs().format("YYYY-MM-DD HH:mm:ss")}' where ${uniCon}`), execute(`./shell/update.sh ${info.name} ${path}`, signal)])
|
||||||
.then(cmd => progress.set(30, cmd))
|
.then(cmd => progress.set(30, info?.id))
|
||||||
.then(() => execute(`cd ${path}&&npm run apps&&node bin/pages.js ${id}&&npm run build`, signal))
|
.then(() => execute(`cd ${path}&&npm run apps&&node bin/pages.js ${id}&&npm run build`, signal))
|
||||||
.then(cmd => progress.set(70, cmd))
|
.then(cmd => progress.set(70, info?.id))
|
||||||
.then(() => fse.emptyDir(dist))
|
.then(() => fse.emptyDir(dist))
|
||||||
.then(() => execute(`./shell/move.sh ${info.type} ${path} ${dist}`, signal))
|
.then(() => execute(`./shell/move.sh ${info.type} ${path} ${dist}`, signal))
|
||||||
.then(cmd => progress.set(90, cmd))
|
.then(cmd => progress.set(90, info?.id))
|
||||||
.then(() => db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`))
|
.then(() => db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`))
|
||||||
.then(() => db.detail({table: "node_custom_config", id}))
|
.then(() => db.detail({table: "node_custom_config", id}))
|
||||||
.then(row => progress.finish(row))
|
.then(row => progress.finish(row))
|
||||||
|
|||||||
Reference in New Issue
Block a user