diff --git a/src/websocket/custom/getZip.js b/src/websocket/custom/getZip.js index 373557b..b8ce7d4 100644 --- a/src/websocket/custom/getZip.js +++ b/src/websocket/custom/getZip.js @@ -26,13 +26,14 @@ const handleZip = (id, ws) => { }, 4000) } - stop() { + stop(row) { if (this.timer) clearInterval(this.timer) + sendMessage({code: 1, row}) } - finish(remark) { + finish(row) { if (this.timer) clearInterval(this.timer) - sendMessage({code: 0, progress: 100, remark}) + sendMessage({code: 0, progress: 100, row}) } } @@ -57,11 +58,10 @@ const handleZip = (id, ws) => { .then(row => progress.finish(row)) .catch(err => { console.log(err) - progress.stop() const msg = `执行失败:${err.cmd}` return db.query(`update node_custom_config set error='${msg}',zipTime=null where ${uniCon}`) .then(() => db.detail({table: "node_custom_config", id})) - .then(row => sendMessage({code: 1, row})) + .then(row => progress.stop(row)) .catch(() => 0) }) }