Files
MBTI_wang/douyin-miniprogram/utils/enterpriseContext.js
Ghost e672ad4ede feat: 双端题库统一与 PDP/DISC 结果文案、测评 API 与企测上下文
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
2026-03-31 15:26:21 +08:00

45 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 抖音小程序企业上下文(与微信 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
}