优化代码

This commit is contained in:
aixianling
2022-05-27 09:54:10 +08:00
parent be0732bbd1
commit 64f0cf5708

View File

@@ -1,6 +1,7 @@
const db = require("../../utils/dbUitls");
const dayjs = require("dayjs")
const execute = require("../../tools/exec");
const fse = require("fs-extra");
module.exports = {
action: "/node/autodeploy/getZip",
method: "post",
@@ -11,7 +12,9 @@ module.exports = {
let info = res?.[0]
if (info?.id) {
db.query(`update node_autodeploy set download=null,error=null where id='${info.id}'`).then(() => {
setTimeout(() => response.send({code: 0}), 2000)
fse.emptydir(info.target, () => {
response.send({code: 0})
})
})
execute(`${info.updateShell}`).then(() => execute(`${info.libShell}`))
.then(() => {