增加同一个小程序不同项目的兼容

This commit is contained in:
aixianling
2022-06-01 10:51:24 +08:00
parent dd329d6e60
commit d3faa0c037

View File

@@ -3,11 +3,11 @@ module.exports = {
action: "/node/wxmp/addOrUpdate",
method: "post",
execute: (request, response) => {
let {appid, privateKey, projectPath, version, miniapp_appid} = request.body,
form = {appid, privateKey, projectPath, version}, sql
let {appid, privateKey, projectPath, version, miniapp_appid, id: pid} = request.body,
form = {appid, privateKey, projectPath, version, pid}, sql
if (form.appid) {//编辑
let arr = Object.keys(form).filter(e => form[e]).map(e => `${e}='${form[e]}'`)
sql = `update node_wxmp_config set ${arr.join(",")} where appid='${form.appid}'`
sql = `update node_wxmp_config set ${arr.join(",")} where appid='${form.appid}' and pid='${pid}'`
} else {//新增
let cols = [], arr = []
form.appid = miniapp_appid