同步产品库内容
This commit is contained in:
@@ -1,22 +1,16 @@
|
|||||||
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(`delete from node_wechat_apps where type='${form.type}'`).then(() => {
|
||||||
if (res.length > 0) {//编辑
|
let cols = [], arr = []
|
||||||
let arr = Object.keys(form).filter(e => form[e]).map(e => `${e}='${form[e]}'`)
|
Object.keys(form).map(e => {
|
||||||
return `update node_wechat_apps set ${arr.join(",")} where id='${form.id}' and type='${form.type}'`
|
if (form[e]) {
|
||||||
} else {//新增
|
cols.push(e)
|
||||||
let cols = [], arr = []
|
arr.push(`'${form[e]}'`)
|
||||||
Object.keys(form).map(e => {
|
}
|
||||||
if (form[e]) {
|
})
|
||||||
cols.push(e)
|
return `insert into node_wechat_apps (${cols.join(",")}) values(${arr.join(",")})`
|
||||||
arr.push(`'${form[e]}'`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return `insert into node_wechat_apps (${cols.join(",")}) values(${arr.join(",")})`
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
Reference in New Issue
Block a user