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 打包无错误
这个提交包含在:
@@ -3,24 +3,23 @@ import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { routes } from '../src/routes.ts';
|
||||
|
||||
const adminRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const financialPagePath = path.join(adminRoot, 'src/pages/dashboard/financial/index.tsx');
|
||||
const financialLocalePath = path.join(adminRoot, 'src/pages/dashboard/financial/locale/index.ts');
|
||||
const mainLocalePath = path.join(adminRoot, 'src/locale/index.ts');
|
||||
const routesPath = path.join(adminRoot, 'src/routes.ts');
|
||||
|
||||
const EMOJI_RE =
|
||||
/[\u{1F300}-\u{1F5FF}\u{1F600}-\u{1F64F}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}]/u;
|
||||
|
||||
test('1. routes.ts 必须在 dashboard 下注册 dashboard/financial 且未被 ignore', () => {
|
||||
const dashboardGroup = routes.find((r) => r.key === 'dashboard');
|
||||
assert.ok(dashboardGroup, 'routes.ts 必须包含 dashboard 分组');
|
||||
assert.ok(dashboardGroup.children, 'dashboard 必须有 children');
|
||||
|
||||
const financialRoute = dashboardGroup.children.find((r) => r.key === 'dashboard/financial');
|
||||
assert.ok(financialRoute, '必须在 dashboard 下注册 dashboard/financial 路由');
|
||||
assert.notEqual(financialRoute.ignore, true, 'financial 路由必须在侧边栏正常展示');
|
||||
const content = fs.readFileSync(routesPath, 'utf-8');
|
||||
assert.ok(content.includes("key: 'dashboard/financial'"), '必须注册 dashboard/financial');
|
||||
assert.ok(
|
||||
!/key:\s*'dashboard\/financial'[\s\S]{0,80}ignore:\s*true/.test(content),
|
||||
'financial 路由必须在侧边栏正常展示'
|
||||
);
|
||||
});
|
||||
|
||||
test('2. 主词典与多语言包必须包含 menu.dashboard.financial 翻译', () => {
|
||||
@@ -49,6 +48,9 @@ test('3. dashboard/financial 页面必须存在,且具备 COO/CFO 视角切换
|
||||
'页面必须支持 coo 与 cfo 视角状态切换'
|
||||
);
|
||||
|
||||
assert.ok(!content.includes('14500'), '禁止硬编码演示 MRR');
|
||||
assert.ok(!content.includes('Vanguard Global'), '禁止硬编码演示账单');
|
||||
|
||||
// 必须使用 Arco 核心组件
|
||||
assert.ok(content.includes('@arco-design/web-react'), '必须引入 Arco Design');
|
||||
assert.ok(content.includes('Table'), '必须包含 Table 表格展示账目流水');
|
||||
|
||||
在新工单中引用
屏蔽一个用户