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,改后统计两口径一致
这个提交包含在:
@@ -14,10 +14,12 @@ describe('第五十批大神收益统计范围闸门', () => {
|
||||
expect(repoCode).not.toContain('OR companion_name LIKE ?');
|
||||
});
|
||||
|
||||
it('收益汇总与走势只按 expert_id 统计', () => {
|
||||
const stats = repoCode.slice(repoCode.indexOf('async getExpertStats('), repoCode.indexOf('async getExpertStats(') + 600);
|
||||
expect(stats).toContain('WHERE expert_id = ?');
|
||||
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, 4000)).toContain('WHERE expert_id = ?');
|
||||
expect(trends.slice(0, 6000)).toContain('(expert_id = ? OR claimed_by = ?)');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -60,4 +60,11 @@ describe('第一百批系统告警与后台审计', () => {
|
||||
expect(indexCode).toContain('openidValid');
|
||||
expect(indexCode).toContain('请改用真实微信登录用户测试');
|
||||
});
|
||||
|
||||
it('订单 expert_id 必须统一为大神档案 id,统计口径兼容用户 id', () => {
|
||||
expect(repo).toContain('const companionIdForOrder = comp ? Number(comp.id) || expertId : expertId;');
|
||||
expect(repo).toContain('resolveExpertOrderScope');
|
||||
expect(repo).toContain('(expert_id = ? OR claimed_by = ?)');
|
||||
expect(mysql).toContain('SET o.expert_id = c.id');
|
||||
});
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户