From 56021924ef779570e2ec6614cc97f8052bfc7b4c Mon Sep 17 00:00:00 2001 From: aixianling Date: Mon, 17 Jun 2024 17:39:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=88=B0=E6=96=87=E4=BB=B6=E5=BD=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/rest/custom/getZip.js | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 389d9b3..0dfd2b7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /package-lock.json /zips/ /aicode/ +/logs/ diff --git a/src/rest/custom/getZip.js b/src/rest/custom/getZip.js index 07c33f0..da6d559 100644 --- a/src/rest/custom/getZip.js +++ b/src/rest/custom/getZip.js @@ -17,7 +17,7 @@ module.exports = { mp: 'dvcp_v2_wxmp' }[info.type] || {} let path = `../${buildPath}`, - {dist} = info + {dist} = info dist = dist || `../zips/${info.name}v${info.version || "1.0.0"}` Promise.all([ execute(`./shell/update.sh ${info.name} ${path}`), @@ -26,13 +26,13 @@ module.exports = { response.send({code: 0}) }, 1000)) execute(`cd ${path}&&npm run apps&&node bin/pages.js ${id}&&npm run build`) - .then(() => fse.emptyDir(dist)) - .then(() => execute(`./shell/move.sh ${info.type} ${path} ${dist}`)) - .then(() => { - return db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`) - }).catch(err => { + .then(() => fse.emptyDir(dist)) + .then(() => execute(`./shell/move.sh ${info.type} ${path} ${dist}`)) + .then(() => { + return db.query(`update node_custom_config set download='${dayjs().format("YYYY-MM-DD HH:mm:ss")}',error='' where ${uniCon}`) + }).catch(err => { console.log(err) - return db.query(`update node_custom_config set error='${err}',zipTime=null where ${uniCon}`) + return fse.outputFile(`./logs/errors/${dayjs().format("YYYY-MM-DD")}.log`, err) }) } else return response.send({code: 1, err: "无法找到定制项目信息"}) }).catch(err => {