精简代码
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
const db = require("../../utils/dbUitls");
|
const db = require("../../utils/dbUitls");
|
||||||
const zip = require("../../tools/zipProject")
|
|
||||||
const dayjs = require("dayjs")
|
const dayjs = require("dayjs")
|
||||||
|
const execute = require("./exec");
|
||||||
module.exports = {
|
module.exports = {
|
||||||
action: "/node/autodeploy/getZip",
|
action: "/node/autodeploy/getZip",
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -11,10 +11,8 @@ module.exports = {
|
|||||||
let info = res?.[0]
|
let info = res?.[0]
|
||||||
if (info?.id) {
|
if (info?.id) {
|
||||||
db.query(`update node_autodeploy set download=null,error=null where id='${info.id}'`)
|
db.query(`update node_autodeploy set download=null,error=null where id='${info.id}'`)
|
||||||
setTimeout(() => {
|
execute(`${info.updateShell}`).then(() => execute(`${info.libShell}`))
|
||||||
response.send({code: 0})
|
.then(() => {
|
||||||
}, 2000)
|
|
||||||
zip(info).then(() => {
|
|
||||||
db.query(`update node_autodeploy set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where id='${info.id}'`)
|
db.query(`update node_autodeploy set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where id='${info.id}'`)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(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