From 7e5c1b91d5bcc5450ba2be3b42c936ed9d3ca8d5 Mon Sep 17 00:00:00 2001 From: aixianling Date: Wed, 28 Dec 2022 10:21:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E8=BD=BD=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rest/custom/download.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rest/custom/download.js b/src/rest/custom/download.js index f3e6762..9379702 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}`, zipPath = `/home/deploy/node_deploy/zips/${info.id}.zip` + let path = `${info.dist || "../zips"}`, 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(() => execute(`cd ${path}&&mv ${info.id}.zip /home/deploy/node_deploy/zips`)) + .then(() => path == "../zips" ? execute(`cd ${path}&&mv ${info.id}.zip ../zips`) : 1) .then(() => { console.log('压缩完成!') setTimeout(() => {