更改小程序同步策略

This commit is contained in:
aixianling
2023-03-16 10:18:51 +08:00
parent a3e1694d4f
commit 3d3a9608aa
3 changed files with 55 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
const axios = require('axios')
const {chalkTag, findPages, fsExtra, fs} = require("./tools");
const PageBase = require("dvcp-wui/utils/PageBase");
let apps = {list: [], desc: "用于产品库主页面获取应用使用", type: "mp"}
@@ -16,13 +15,6 @@ const getFileInfo = (app, file) => {
})
}
}
const saveApps = app => {
if (app.list.length > 0) {
axios.post("http://192.168.1.87:12525/node/wechatapps/addOrUpdate", app).then(res => {
if (res?.data?.code == 0) chalkTag.done("产品库目录已同步至后台数据库...")
}).catch(err => 0).finally(() => fsExtra.outputJson('src/config.json', {apps: app.list}))
}
}
const start = () => {
chalkTag.info('开始生成pages.json...')
let json = {
@@ -67,7 +59,7 @@ const start = () => {
}
})
]).then(() => {
saveApps(apps)
fsExtra.outputJson('src/config.json', {apps: apps.list})
fsExtra.outputJson('src/pages.json', json, () => {
chalkTag.done('生成pages.json')
})