增加关于标准库的筛选
This commit is contained in:
32
src/rest/custom/download.js
Normal file
32
src/rest/custom/download.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const dbUtils = require("../../utils/dbUitls");
|
||||
const fse = require("fs-extra");
|
||||
const execute = require("../../tools/exec");
|
||||
module.exports = {
|
||||
action: "/node/custom/download",
|
||||
method: "post",
|
||||
execute: (request, response) => {
|
||||
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-service/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-service/zips`))
|
||||
.then(() => {
|
||||
console.log('压缩完成!')
|
||||
setTimeout(() => {
|
||||
response.download(zipPath)
|
||||
}, 1000)
|
||||
})
|
||||
} else response.send({code: 1, err: "没有打包文件!"})
|
||||
})
|
||||
} else response.send({code: 1, err: "无法找到项目信息"})
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
response.send({code: 1, err: err.sqlMessage})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,10 @@ module.exports = {
|
||||
action: "/node/wechatapps/list",
|
||||
method: "post",
|
||||
execute: (request, response) => {
|
||||
let total = 0, records = [], {size, current = 1, name = "", type} = request.query
|
||||
let total = 0, records = [], {size, current = 1, name = "", type, isMain} = request.query
|
||||
if (type) {
|
||||
let condition = `where type='${type}' and (name like '%${name}%' or label like '%${name}%')`
|
||||
isMain && (condition += ` and libPath not like '%project%'`)
|
||||
Promise.all([
|
||||
dbUtils.query(`select 1 from node_wechat_apps ${condition}`).then(res => {
|
||||
return total = res.length
|
||||
|
||||
Reference in New Issue
Block a user