新版小程序打包
This commit is contained in:
21
src/rest/wechat/sync.js
Normal file
21
src/rest/wechat/sync.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const dbUtils = require("../../utils/dbUitls");
|
||||
uid = e => [e.appid, e.corpId].join("_")
|
||||
module.exports = {
|
||||
action: "/node/wxmp/sync",
|
||||
method: "post",
|
||||
execute: (request, response) => {
|
||||
let records = {}, meta = []
|
||||
Promise.all([
|
||||
dbUtils.query("select * from app_dvcp_config").then(res => meta = res),
|
||||
dbUtils.query("select * from node_wxmp_deploy").then(res => res?.map(e => records[uid(e)] = e))
|
||||
]).then(() => Promise.all(meta.map(e => {
|
||||
const {name, miniapp_appid: appid, corp_id: corpId, web_url: webUrl} = e
|
||||
const id = records[uid({appid, corpId})]?.id
|
||||
delete e.system_info
|
||||
return dbUtils.addOrUpdate({
|
||||
table: 'node_wxmp_deploy',
|
||||
form: {id, name, appid, corpId, webUrl, dvcpConfig: e}
|
||||
})
|
||||
}))).finally(() => response.send({code: 0, data: ""}))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user