定制项目打包接口完成
This commit is contained in:
@@ -3,11 +3,10 @@ module.exports = {
|
|||||||
action: "/node/custom/addOrUpdate",
|
action: "/node/custom/addOrUpdate",
|
||||||
method: "post",
|
method: "post",
|
||||||
execute: (request, response) => {
|
execute: (request, response) => {
|
||||||
let form = request.body
|
let {id, name, type, customPath, apps, createTime, dist, version, zipTime, download, error, extra} = request.body
|
||||||
delete form.appList
|
|
||||||
dbUtils.addOrUpdate({
|
dbUtils.addOrUpdate({
|
||||||
table: 'node_custom_config',
|
table: 'node_custom_config',
|
||||||
form
|
form: {id, name, type, customPath, apps, createTime, dist, version, zipTime, download, error, extra}
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
response.send({code: 0, data})
|
response.send({code: 0, data})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|||||||
@@ -5,15 +5,22 @@ module.exports = {
|
|||||||
execute: (request, response) => {
|
execute: (request, response) => {
|
||||||
let {id} = request.query
|
let {id} = request.query
|
||||||
dbUtils.detail({table: 'node_custom_config', id}).then(data => {
|
dbUtils.detail({table: 'node_custom_config', id}).then(data => {
|
||||||
if (data.apps) {
|
data.apps = JSON.parse(data.apps || "[]")
|
||||||
data.apps = JSON.parse(data.apps)
|
data.extra = JSON.parse(data.extra || null)
|
||||||
if (data.apps?.length > 0)
|
Promise.all([
|
||||||
dbUtils.query(`select * from node_wechat_apps where id in (${data.apps.map(e=>`'${e}'`)?.toString()})`).then(res => {
|
dbUtils.query(`select * from node_wechat_apps where id in (${data.apps?.map(e=>`'${e}'`)?.toString()})`)
|
||||||
data.appList = res
|
.then(res => data.appList = [data.appList, res].flat()),
|
||||||
response.send({code: 0, data})
|
dbUtils.query(`select * from node_wechat_apps where type='${data.type}' and id like '%project_${data.customPath}%'`)
|
||||||
})
|
.then(res => data.appList = [data.appList, res].flat())
|
||||||
else response.send({code: 0, data})
|
]).then(() => {
|
||||||
} else response.send({code: 0, data})
|
data.appList = data.appList.filter(Boolean).map(e => {
|
||||||
|
if (data.type == 'mp') {
|
||||||
|
e.tabbar = e.id == data.extra?.tabBar.list?.[2].id
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
})
|
||||||
|
response.send({code: 0, data})
|
||||||
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
response.send({code: 1, err: err?.sqlMessage || err || ""})
|
response.send({code: 1, err: err?.sqlMessage || err || ""})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user