1、修复了用户详情与人脸/DISC 展示、手机号与资料校验、相机页与测试选择等体验问题。 2、新增了 SystemDefaultEnterprise、discDisplay、管理端设置扩展接口;CrmReport/Test/Analyze 等 API 与路由能力补强。 3、优化了 resultFormat、descriptions、payment、企业上下文;海报与 PDP/DISC 文案;超管 Commerce/Users 与 admin Settings/Users。 Made-with: Cursor
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/**
|
||
* 抖音小程序企业上下文(与微信 miniprogram 逻辑对齐,storage 用 tt)
|
||
*/
|
||
|
||
function getEffectiveEnterpriseId() {
|
||
const app = getApp()
|
||
const gd = app.globalData || {}
|
||
const fromScene = gd.enterpriseIdFromScene
|
||
if (fromScene != null && Number(fromScene) > 0) {
|
||
return Number(fromScene)
|
||
}
|
||
const u = gd.userInfo || tt.getStorageSync('userInfo') || {}
|
||
const bound = u.enterpriseId
|
||
if (bound != null && Number(bound) > 0) {
|
||
return Number(bound)
|
||
}
|
||
const def = gd.defaultEnterpriseId
|
||
if (def != null && Number(def) > 0) {
|
||
return Number(def)
|
||
}
|
||
return null
|
||
}
|
||
|
||
/**
|
||
* 与微信 miniprogram/utils/enterpriseContext.getEnterpriseIdForApiPayload 一致。
|
||
* 个人版无 scene 时返回 null;后端 submit / analyze 会用绑定企业或系统默认企业落库。
|
||
*/
|
||
function getEnterpriseIdForApiPayload() {
|
||
const app = getApp()
|
||
const gd = app.globalData || {}
|
||
const scope = gd.appScope || 'personal'
|
||
if (scope === 'personal') {
|
||
const fromScene = gd.enterpriseIdFromScene
|
||
if (fromScene != null && Number(fromScene) > 0) {
|
||
return Number(fromScene)
|
||
}
|
||
return null
|
||
}
|
||
return getEffectiveEnterpriseId()
|
||
}
|
||
|
||
module.exports = {
|
||
getEffectiveEnterpriseId,
|
||
getEnterpriseIdForApiPayload
|
||
}
|