精简代码
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const db = require("../../utils/dbUitls");
|
||||
const zip = require("../../tools/zipProject")
|
||||
const dayjs = require("dayjs")
|
||||
const execute = require("./exec");
|
||||
module.exports = {
|
||||
action: "/node/autodeploy/getZip",
|
||||
method: "post",
|
||||
@@ -11,10 +11,8 @@ module.exports = {
|
||||
let info = res?.[0]
|
||||
if (info?.id) {
|
||||
db.query(`update node_autodeploy set download=null,error=null where id='${info.id}'`)
|
||||
setTimeout(() => {
|
||||
response.send({code: 0})
|
||||
}, 2000)
|
||||
zip(info).then(() => {
|
||||
execute(`${info.updateShell}`).then(() => execute(`${info.libShell}`))
|
||||
.then(() => {
|
||||
db.query(`update node_autodeploy set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where id='${info.id}'`)
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
const fse = require("fs-extra");
|
||||
const execute = require("./exec")
|
||||
module.exports = info => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fse.emptyDir(`zips/${info.id}`, err => {
|
||||
if (!err) {
|
||||
execute(`${info.updateShell}`)
|
||||
.then(() => execute(`${info.libShell}`))
|
||||
.then(() => resolve())
|
||||
.catch(errs => {
|
||||
console.log(errs)
|
||||
reject(errs)
|
||||
})
|
||||
} else {
|
||||
reject(err)
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user