1、修复了测评/结果页与个人中心展示不一致问题;废弃独立 questions.js,统一使用 questionBank;结果格式与详情解析相关问题。 2、新增了 PdpDiscResultText(PDP+DISC 双类型摘要文案)、抖音 questionBank 与 enterpriseContext;扩展 api/Test 与路由、管理端 Order 与 ExtractsTestResults。 3、优化了 resultFormat 与 questionBank 组织方式、UserDetailDialog;移除不再使用的 mbti_test_results 恢复 SQL/脚本。 Made-with: Cursor
45 lines
1.1 KiB
JavaScript
45 lines
1.1 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 一致
|
||
*/
|
||
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
|
||
}
|