定制项目打包接口完成

This commit is contained in:
aixianling
2022-07-07 17:47:49 +08:00
parent 091deb59ef
commit 33e2c78d90

View File

@@ -10,9 +10,6 @@ module.exports = {
let info = res?.[0], sql
if (info?.id) {
sql = `update node_custom_config set download=null,error=null,zipTime='${dayjs().format("YYYY-MM-DD HH:mm:ss")}' where ${uniCon}`
db.query(sql).then(() => setTimeout(() => {
response.send({code: 0})
}, 2000))
const buildPath = {
web: 'base-web',
wxwork: 'base-wxcp',
@@ -20,6 +17,12 @@ module.exports = {
}[info.type] || {}
const path = `/home/deploy/node-service/${buildPath}`,
dest = `/home/deploy/node-service/customZips/${id}/`
Promise.all([
execute(`/root/node-service/update.sh ${info.name} ${path}`),
db.query(sql)
]).then(() => setTimeout(() => {
response.send({code: 0})
}, 5000))
execute(`cd ${path}&&npm run apps&&node bin/pages.js ${id}&&npm run build`)
.then(() => fse.emptyDir(dest))
.then(() => execute(`/root/node-service/move.sh ${info.type} ${path} ${dest}`))