文件
shanghaipeiwan/server/tests/expert-stats-scope.spec.ts
xcbyy 81368f870f fix(order): 统一 expert_id 为大神档案 id,统计兼容历史接单;修复提现卡单告警误报
- claimOrder 写入 expert_id=companion.id、claimed_by=user.id;启动时幂等回填历史 expert_id=claimed_by 的数据

- getExpertStats / getExpertRevenueTrends 按 (expert_id=? OR claimed_by=?) 双口径统计,解决工作台与接单大厅口径不一致导致漏单

- withdrawals 新增 updated_at(ON UPDATE),提现卡单巡检改用最后更新时间,避免审核旧工单立即误报

- 115 套件/752 用例全绿;线上实测抢单写入 expert_id=9/claimed_by=2010,改后统计两口径一致
2026-10-22 10:31:21 +08:00

26 行
1.1 KiB
TypeScript

// 已读取AGENTS.md
import * as fs from 'fs';
import * as path from 'path';
/**
* 第五十批回归闸门:大神收益统计不得跨大神串算
*/
describe('第五十批大神收益统计范围闸门', () => {
const rootDir = path.resolve(__dirname, '../../');
const repoCode = fs.readFileSync(path.join(rootDir, 'server/src/db/repository.ts'), 'utf-8');
it('不得再用 companion_name LIKE 匹配聚合作弊式占位名', () => {
expect(repoCode).not.toContain("'%我%'");
expect(repoCode).not.toContain('OR companion_name LIKE ?');
});
it('收益汇总与走势必须按档案 id / 认领用户 id 双口径统计,避免漏算', () => {
const start = repoCode.indexOf('async getExpertStats(');
const stats = repoCode.slice(start, start + 1600);
expect(stats).toContain('resolveExpertOrderScope');
expect(stats).toContain('(expert_id = ? OR claimed_by = ?)');
const trends = repoCode.slice(repoCode.indexOf('async getExpertRevenueTrends('));
expect(trends.slice(0, 6000)).toContain('(expert_id = ? OR claimed_by = ?)');
});
});