增加了小程序产品库,应用模块管理

This commit is contained in:
aixianling
2022-05-12 10:40:23 +08:00
parent ec7adbbe71
commit c7f56d7958
2 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
const dbUtils = require("../../utils/dbUitls");
module.exports = {
action: "/node/wechatapps/list",
method: "post",
execute: (request, response) => {
let total = 0, records = [], {size, current = 1, name = ""} = request.query
Promise.all([
dbUtils.query(`select 1 from node_wechat_apps`).then(res => {
return total = res.length
}),
new Promise(resolve => {
let sql = `select * from node_wechat_apps where name like '%${name}%' limit ${(current-1)*size},${size}`
dbUtils.query(sql).then(res => {
records = res
resolve()
}).catch(err => {
response.send({code: 1, err: err.sqlMessage})
})
})
]).then(() => {
response.send({
code: 0,
data: {records, total}
})
})
}
}