From 236ff91eafe63befc5fbc3fb7db7a8217c72a143 Mon Sep 17 00:00:00 2001 From: aixianling Date: Wed, 28 Dec 2022 16:05:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BD=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rest/custom/download.js | 4 ++-- src/rest/custom/getZip.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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)