diff --git a/src/rest/custom/download.js b/src/rest/custom/download.js index 9379702..2802bc3 100644 --- a/src/rest/custom/download.js +++ b/src/rest/custom/download.js @@ -8,13 +8,13 @@ module.exports = { let id = request.query?.id dbUtils.detail({table: 'node_custom_config', id}).then(info => { if (info?.id) { - let path = `${info.dist || "../zips"}`, zipPath = `../zips/${info.id}.zip` + let path = `${info.dist || `../zips/${id}`}`, zipPath = `../zips/${info.id}.zip` fse.removeSync(zipPath) fse.pathExists(path, (err, exists) => { console.log(`${path}=========>${exists}`) if (exists) { execute(`cd ${path}&&zip -r ${info.id}.zip .`) - .then(() => path == "../zips" ? execute(`cd ${path}&&mv ${info.id}.zip ../zips`) : 1) + .then(() => execute(`cd ${path}&&mv ${info.id}.zip ../zips`)) .then(() => { console.log('压缩完成!') setTimeout(() => { diff --git a/src/rest/custom/getZip.js b/src/rest/custom/getZip.js index de218c7..073f308 100644 --- a/src/rest/custom/getZip.js +++ b/src/rest/custom/getZip.js @@ -16,8 +16,8 @@ module.exports = { wxwork: 'base-wxcp', mp: 'dvcp_v2_wxmp' }[info.type] || {} - const path = `/home/deploy/node_deploy/${buildPath}`, - {dist} = info + const path = `../${buildPath}`, + {dist = `../zips/${id}`} = info Promise.all([ execute(`./shell/update.sh ${info.name} ${path}`), db.query(sql)