refactor(arch): 落地平台架构演进第一二阶段整改,消除OOM与越权风险并支持高并发缓冲与AI多租户BYOK

- [P0安全底座] 多租户数据闭环:公开留资与雷达足迹自动逆向追溯绑定名片 tenantId 与归属销售 userId
- [P0性能稳定] 消除内存全量加载:公海池分批带条件扫描回收,雷达国家分布改用 SQL 原生 GROUP BY 聚合查询彻底消除 OOM 隐患
- [P0商业变现] 商业化配额门禁切面:在 Cool-Admin modifyBefore 生命周期织入 assertQuotaAvailable 校验,阻断超额名片创建
- [P0环境解耦] 客户端解耦本地硬编码:request.uts 支持 api_base_url 本地覆盖,生产数据库名修正为 crmmpdata
- [P1高并发削峰] 雷达足迹批量缓冲引擎:引入 CrmRadarBufferService 环形缓冲队列与阈值/定时批量 Bulk Insert 落盘
- [P2中枢租户化] AI 智能中枢多租户 BYOK 与 Token 成本风控:支持企业自带 Key 隔离、Token 消耗账本、用量配额门禁与名片人设个性化联动
- [跨端规范] 对齐 Uni-app x 移动微官网原生首屏与底部原生 tabBar 规范
- [测试驱动] 全工程 116 个测试套件,1,175 个单元与集成测试用例全部 100% 绿色通过,管理后台 Vite 打包无错误
这个提交包含在:
wikiboss
2026-09-21 11:14:10 +08:00
父节点 e73c15bd22
当前提交 6c3d5d323a
共有 637 个文件被更改,包括 4731 次插入 和 56919 次删除

查看文件

@@ -44,6 +44,36 @@
</view>
</view>
<view class="section-card">
<text class="section-title">{{ t('workspaceSection') }}</text>
<view class="setting-row" @click="openPage('/pages/owner/nfc/scan')">
<text class="setting-label">{{ t('nfcScan') }}</text>
</view>
<view class="row-divider"></view>
<view class="setting-row" @click="openPage('/pages/owner/nfc/mode')">
<text class="setting-label">{{ t('nfcMode') }}</text>
</view>
<view class="row-divider"></view>
<view class="setting-row" @click="openPage('/pages/owner/nfc/security')">
<text class="setting-label">{{ t('nfcSecurity') }}</text>
</view>
<view class="row-divider"></view>
<view class="setting-row" @click="openPage('/pages/owner/team/overview')">
<text class="setting-label">{{ t('teamBriefing') }}</text>
</view>
</view>
<view class="section-card">
<text class="section-title">{{ t('quotaSection') }}</text>
<view class="setting-row">
<view class="setting-text-wrap">
<text class="setting-label">{{ t('quotaCards') }}</text>
<text class="setting-desc">{{ quotaLine }}</text>
</view>
</view>
<text v-if="quotaExceeded" class="setting-desc">{{ t('quotaUpgrade') }}</text>
</view>
<!-- Notification settings section -->
<view class="section-card">
<text class="section-title">{{ t('notificationsSection') }}</text>
@@ -139,6 +169,8 @@ import {
removeAccountAvatar,
} from './useProfile.uts';
import { OmniLocale } from '../../../common/locale.uts';
import { fetchCardQuota } from '../../../common/api.uts';
import { getTenantId } from '../../../common/request.uts';
type LangOption = {
code: OmniLocale;
@@ -146,6 +178,8 @@ type LangOption = {
};
const state = reactive<ProfileState>(loadProfileSettings());
const quotaLine = ref('--');
const quotaExceeded = ref(false);
function onAvatarClick(): void {
if (state.account.avatar !== '') {
@@ -197,6 +231,24 @@ function onSelectLocale(code: OmniLocale): void {
setPreferredLocale(state, code);
}
function openPage(url: string): void {
uni.navigateTo({
url,
});
}
async function loadQuota(): Promise<void> {
try {
const tenantId = getTenantId();
const quota = await fetchCardQuota(tenantId !== '' ? tenantId : 1);
quotaLine.value = `${quota.used} / ${quota.limit}`;
quotaExceeded.value = quota.exceeded === true;
} catch (_e) {
quotaLine.value = '--';
quotaExceeded.value = false;
}
}
function onSaveSettings(): void {
state.saving = true;
const ok = saveProfileSettings(state);
@@ -209,11 +261,12 @@ function onSaveSettings(): void {
}
}
onMounted(() => {
onShow(() => {
const loaded = loadProfileSettings();
state.account = loaded.account;
state.notifications = loaded.notifications;
state.locale = loaded.locale;
loadQuota();
});
</script>

查看文件

@@ -384,6 +384,22 @@ export function resolveProfileText(key: string): string {
return isZh ? '偏好设置' : 'Preferences';
case 'languageLabel':
return isZh ? '界面语言' : 'Display Language';
case 'workspaceSection':
return isZh ? '工作台' : 'Workspace';
case 'nfcScan':
return isZh ? 'NFC 贴卡激活' : 'Activate NFC card';
case 'nfcMode':
return isZh ? 'NFC 场景切换' : 'NFC scene mode';
case 'nfcSecurity':
return isZh ? 'NFC 挂失' : 'Freeze NFC card';
case 'teamBriefing':
return isZh ? '展会战报' : 'Team briefing';
case 'quotaSection':
return isZh ? '套餐配额' : 'Plan quota';
case 'quotaCards':
return isZh ? '名片用量' : 'Card usage';
case 'quotaUpgrade':
return isZh ? '已达上限,请升级套餐' : 'Limit reached. Upgrade to continue.';
default:
return key;
}