feat: 同步管理端、用户端与后端业务,并接通线上 Web 接口
补齐平台订阅、外部登录、CRM 同步与用户端页面;Nginx 转发用户端接口,登录页使用 Google 与 Apple 标志。 Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
@@ -96,3 +96,112 @@ test('4. crm/pipeline 必须支持泳道快速录入商机 Modal 与对应语言
|
||||
assert.ok(localeContent.includes('crmPipeline.action.quickAdd'), '语言包必须包含 crmPipeline.action.quickAdd');
|
||||
assert.ok(localeContent.includes('crmPipeline.modal.quickAddTitle'), '语言包必须包含 crmPipeline.modal.quickAddTitle');
|
||||
});
|
||||
|
||||
test('5. crm/pipeline 阶段变更必须写回 updateStatus,失败时回滚原列并 Message.error', () => {
|
||||
const content = fs.readFileSync(pipelinePagePath, 'utf-8');
|
||||
|
||||
assert.ok(
|
||||
content.includes('/api/admin/crm/lead/updateStatus') ||
|
||||
content.includes('admin/crm/lead/updateStatus'),
|
||||
'改阶段必须写回 POST /api/admin/crm/lead/updateStatus'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('handleStatusChange') || content.includes('onChange'),
|
||||
'必须通过 Select/点击改阶段触发写回'
|
||||
);
|
||||
assert.ok(
|
||||
/setColumns\s*\(/.test(content),
|
||||
'阶段变更必须更新看板列(乐观移列或回滚)'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('rollback') ||
|
||||
content.includes('prevColumns') ||
|
||||
content.includes('snapshot') ||
|
||||
/setColumns\(\s*(rollback|prev|snapshot|previous)/.test(content) ||
|
||||
content.includes('setColumns(rollbackColumns)') ||
|
||||
content.includes('setColumns(snapshot)') ||
|
||||
content.includes('setColumns(prevColumns)'),
|
||||
'请求失败必须把卡片放回原列,禁止只留在新列假装已保存'
|
||||
);
|
||||
assert.ok(content.includes('Message.error'), '失败必须 Message.error 提示');
|
||||
assert.ok(content.includes('crmPipeline.update.fail'), '失败提示必须走 update.fail 文案');
|
||||
assert.ok(
|
||||
content.includes('axios.post') && content.includes('UPDATE_STATUS_API'),
|
||||
'必须 axios.post 调用 UPDATE_STATUS_API,禁止只改本地状态'
|
||||
);
|
||||
|
||||
const localeContent = fs.readFileSync(pipelineLocalePath, 'utf-8');
|
||||
assert.ok(
|
||||
localeContent.includes('crmPipeline.update.fail'),
|
||||
'locale 必须包含阶段写回失败文案'
|
||||
);
|
||||
});
|
||||
|
||||
test('6. R22: 金额只读线索 amount/dealValue,无有效数字不得假总额', () => {
|
||||
const content = fs.readFileSync(pipelinePagePath, 'utf-8');
|
||||
const localeContent = fs.readFileSync(pipelineLocalePath, 'utf-8');
|
||||
|
||||
assert.ok(
|
||||
content.includes('amount') && content.includes('dealValue'),
|
||||
'必须从线索 amount / dealValue 读取金额'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('readLeadAmount') && content.includes('sumStageAmount'),
|
||||
'必须有读单条与汇总阶段金额的函数'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('Number.isFinite'),
|
||||
'金额必须经 Number.isFinite 校验,禁止非数字冒充'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('counted > 0') ||
|
||||
content.includes('counted>0') ||
|
||||
/return counted\s*>\s*0\s*\?\s*total\s*:\s*undefined/.test(content),
|
||||
'无一笔有效金额时必须返回 undefined,禁止汇总成 0'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('crmPipeline.column.amount.empty') &&
|
||||
content.includes('crmPipeline.card.amount.empty'),
|
||||
'无有效金额时必须走 locale 空态文案'
|
||||
);
|
||||
assert.ok(
|
||||
localeContent.includes('crmPipeline.column.amount.empty'),
|
||||
'locale 必须包含列金额空态'
|
||||
);
|
||||
assert.ok(
|
||||
localeContent.includes('crmPipeline.card.amount') &&
|
||||
localeContent.includes('crmPipeline.card.amount.empty'),
|
||||
'locale 必须包含卡片金额与空态文案'
|
||||
);
|
||||
|
||||
// 禁止用 0×条数 / 条数×0 冒充商机金额
|
||||
assert.ok(
|
||||
!/0\s*\*\s*(leads\.length|\.length)/.test(content) &&
|
||||
!/(leads\.length|\.length)\s*\*\s*0/.test(content),
|
||||
'禁止用 0 乘条数冒充商机金额'
|
||||
);
|
||||
// 禁止把缺失金额默认成 0 再累加成假总额
|
||||
assert.ok(
|
||||
!/(amount|dealValue)[^\n]{0,120}\?\?\s*0/.test(content) &&
|
||||
!/\?\?\s*0[^\n]{0,120}(amount|dealValue)/.test(content) &&
|
||||
!/readLeadAmount\([^)]*\)\s*\?\?\s*0/.test(content) &&
|
||||
!/parseFiniteAmount\([^)]*\)\s*\?\?\s*0/.test(content),
|
||||
'禁止 amount/dealValue 缺失时 ?? 0 累加'
|
||||
);
|
||||
assert.ok(
|
||||
!content.includes('99999') &&
|
||||
!content.includes('100000') &&
|
||||
!content.includes('$12,000') &&
|
||||
!content.includes('¥0') &&
|
||||
!content.includes('$0.00'),
|
||||
'禁止写死演示商机总额'
|
||||
);
|
||||
|
||||
// 阶段失败回滚不得被本改动破坏
|
||||
assert.ok(
|
||||
content.includes('setColumns(snapshot)') ||
|
||||
content.includes('setColumns(prevColumns)') ||
|
||||
content.includes('setColumns(rollbackColumns)'),
|
||||
'阶段流转失败仍须回滚原列'
|
||||
);
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户