feat: 同步今日小程序与后台迭代版本
集中提交今日 API、管理端、小程序与部署文档调整,确保 Gitea 主分支与本地最新开发版本一致。 Made-with: Cursor
This commit is contained in:
46
miniprogram/utils/miniprogramAuditGate.js
Normal file
46
miniprogram/utils/miniprogramAuditGate.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 超管审核相关:隐藏神仙 AI Tab/入口;提审模式下另由后端/各页关闭虚拟商品与「了解自己」深度套餐。
|
||||
* - miniprogramAuditMode:提审专用(含虚拟支付合规)
|
||||
* - maintenanceMode / reviewMode:面相审核(用户口语「审核模式」常指其一)
|
||||
*/
|
||||
|
||||
function isAuditHideAiMode(gd) {
|
||||
if (!gd) return false
|
||||
return !!(gd.miniprogramAuditMode || gd.maintenanceMode || gd.reviewMode)
|
||||
}
|
||||
|
||||
function redirectIfMiniprogramAudit(message) {
|
||||
const app = getApp()
|
||||
const gd = app && app.globalData
|
||||
if (!isAuditHideAiMode(gd)) return false
|
||||
wx.showToast({ title: message || '功能升级中', icon: 'none' })
|
||||
setTimeout(() => {
|
||||
wx.switchTab({ url: '/pages/index/index' })
|
||||
}, 300)
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 先拉 runtime(若存在),再若提审则踢回首页;否则执行 callback。
|
||||
*/
|
||||
function ensureRuntimeThenGate(callback) {
|
||||
const app = getApp()
|
||||
const run = () => {
|
||||
if (isAuditHideAiMode(app.globalData)) {
|
||||
redirectIfMiniprogramAudit()
|
||||
return
|
||||
}
|
||||
if (typeof callback === 'function') callback()
|
||||
}
|
||||
if (app && typeof app.getRuntimeConfig === 'function') {
|
||||
app.getRuntimeConfig().then(run).catch(run)
|
||||
return
|
||||
}
|
||||
run()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isAuditHideAiMode,
|
||||
redirectIfMiniprogramAudit,
|
||||
ensureRuntimeThenGate
|
||||
}
|
||||
Reference in New Issue
Block a user