更新应用服务

This commit is contained in:
aixianling
2022-05-16 10:15:52 +08:00
parent a49d799afe
commit 93be499640

View File

@@ -1,7 +1,7 @@
const dbUtils = require("../../utils/dbUitls"); const dbUtils = require("../../utils/dbUitls");
const addOrUpdate = form => { const addOrUpdate = form => {
return dbUtils.query(`select 1 from node_wechat_apps where id=${form.id}`).then(res => { return dbUtils.query(`select 1 from node_wechat_apps where id='${form.id}'`).then(res => {
if (res.length > 0) {//编辑 if (res.length > 0) {//编辑
let arr = Object.keys(form).filter(e => form[e]).map(e => `${e}='${form[e]}'`) let arr = Object.keys(form).filter(e => form[e]).map(e => `${e}='${form[e]}'`)
return `update node_wechat_apps set ${arr.join(",")} where id='${form.name}'` return `update node_wechat_apps set ${arr.join(",")} where id='${form.name}'`
@@ -13,7 +13,7 @@ const addOrUpdate = form => {
arr.push(`'${form[e]}'`) arr.push(`'${form[e]}'`)
} }
}) })
return `insert into node_wechat_apps (id,${cols.join(",")}) values('${form.name}',${arr.join(",")})` return `insert into node_wechat_apps (${cols.join(",")}) values(${arr.join(",")})`
} }
}) })