同步产品库内容

This commit is contained in:
aixianling
2022-06-08 16:28:34 +08:00
parent ac883222ca
commit b677a3fe9f

View File

@@ -16,6 +16,7 @@ module.exports = {
method: "post", method: "post",
execute: (request, response) => { execute: (request, response) => {
let form = request.body let form = request.body
if (form.type) {
dbUtils.query(`delete from node_wechat_apps where type='${form.type}'`).then(() => { dbUtils.query(`delete from node_wechat_apps where type='${form.type}'`).then(() => {
if (form.list?.length > 0) { if (form.list?.length > 0) {
Promise.all(form.list.map(e => addOrUpdate(e).then(sql => dbUtils.query(sql)))).then(() => { Promise.all(form.list.map(e => addOrUpdate(e).then(sql => dbUtils.query(sql)))).then(() => {
@@ -35,5 +36,7 @@ module.exports = {
}).catch(err => { }).catch(err => {
response.send({code: 1, err: err.sqlMessage}) response.send({code: 1, err: err.sqlMessage})
}) })
} else response.send({code: 1, err: "缺少必要参数type"})
} }
} }