diff --git a/src/rest/wechat/getZip.js b/src/rest/wechat/getZip.js index 9c49dbc..a9edd43 100644 --- a/src/rest/wechat/getZip.js +++ b/src/rest/wechat/getZip.js @@ -18,11 +18,14 @@ module.exports = { response.send({code: 0}) }, 2000)) const path = info.projectPath || '/home/deploy/node-service/dvcp_v2_wechat', - dest = `/home/deploy/wxmpZips/${uid}/`, processEnv = info.npmScript || 'build' + dest = `/home/deploy/wxmpZips/${uid}/`, + processEnv = info.npmScript || 'build', + dist = info.npmScript ? `${path}/dist/${info.npmScript}/` : `${path}/dist/build/mp-weixin/` execute(`cd ${path}&&npm run apps&&node bin/pages.js ${appid} ${id}&&npm run ${processEnv}`) .then(() => fse.emptyDir(dest)) - .then(() => fse.copy(`${path}/dist/${processEnv}/mp-weixin/`, dest)) - .then(() => fse.emptyDir(`${path}/dist/build`)) + .then(() => fse.ensureDir(dist)) + .then(() => fse.copy(dist, dest)) + .then(() => fse.emptyDir(dist)) .then(() => { db.query(`update node_wxmp_config set error='ζ‰“εŒ…ζ—Άι—΄:${dayjs().format("YYYY-MM-DD HH:mm:ss")}' where ${uniCon}`) }).catch(err => {