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 次删除

查看文件

@@ -10,13 +10,26 @@ let currentBaseUrl: string = 'http://127.0.0.1:9000';
if (typeof window !== 'undefined' && window.location != null) {
const protocol = window.location.protocol != null && window.location.protocol !== '' ? window.location.protocol : 'http:';
const hostname = window.location.hostname != null && window.location.hostname !== '' ? window.location.hostname : '127.0.0.1';
currentBaseUrl = `${protocol}//${hostname}:9000`;
const port = window.location.port;
if (port === '5173' || port === '5174' || port === '3000' || port === '8080') {
currentBaseUrl = `${protocol}//${hostname}:9000`;
} else if (port != null && port !== '' && port !== '80' && port !== '443') {
currentBaseUrl = `${protocol}//${hostname}:${port}`;
} else {
currentBaseUrl = `${protocol}//${hostname}`;
}
}
// #endif
let currentTimeout: number = 10000;
export function getBaseUrl(): string {
try {
const override = uni.getStorageSync('api_base_url');
if (override != null && String(override).trim() !== '') {
return String(override).trim();
}
} catch (e) {}
return currentBaseUrl;
}
@@ -35,22 +48,41 @@ export function setRequestTimeout(timeout: number): void {
export function getAuthToken(): string {
try {
const val = uni.getStorageSync('token');
return val != null ? String(val) : '';
} catch (e) {
return '';
}
if (val != null && String(val) !== '') {
return String(val);
}
} catch (e) {}
try {
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
const local = localStorage.getItem('token');
if (local != null && String(local) !== '') {
return String(local);
}
}
} catch (e) {}
return '';
}
export function setAuthToken(token: string): void {
try {
uni.setStorageSync('token', token);
} catch (e) {}
try {
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
localStorage.setItem('token', token);
}
} catch (e) {}
}
export function clearAuthToken(): void {
try {
uni.removeStorageSync('token');
} catch (e) {}
try {
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
localStorage.removeItem('token');
}
} catch (e) {}
}
export function getTenantId(): string {