feat: 同步管理端、用户端与后端业务,并接通线上 Web 接口

补齐平台订阅、外部登录、CRM 同步与用户端页面;Nginx 转发用户端接口,登录页使用 Google 与 Apple 标志。

Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
wikiboss
2026-09-23 18:01:47 +08:00
父节点 8ea9c25386
当前提交 62e0ae4435
共有 227 个文件被更改,包括 21855 次插入 和 5264 次删除

查看文件

@@ -127,3 +127,116 @@ test('3. nfc/rules 路由与国际化配置必须完整', () => {
assert.ok(rulesLocaleContent.includes('nfcRules.action.resolve'), '必须包含路由解析文案');
assert.ok(!/\bany\b/.test(rulesLocaleContent), 'locale 禁止使用 any');
});
test('4. placeholder 必须走 i18n,禁止硬编码英文 e.g. 占位', () => {
const content = fs.readFileSync(rulesPagePath, 'utf-8');
const rulesLocaleContent = fs.readFileSync(rulesLocalePath, 'utf-8');
const placeholderKeys = [
'nfcRules.filter.countryCode.placeholder',
'nfcRules.form.name.placeholder',
'nfcRules.form.deviceId.placeholder',
'nfcRules.form.targetCardId.placeholder',
'nfcRules.form.countryCode.placeholder',
'nfcRules.resolve.deviceId.placeholder',
'nfcRules.resolve.countryCode.placeholder',
];
for (const key of placeholderKeys) {
assert.ok(
content.includes(`t['${key}']`),
`页面 placeholder 必须使用 t['${key}']`
);
assert.ok(
rulesLocaleContent.includes(`'${key}'`),
`locale 必须包含 ${key}`
);
}
assert.ok(rulesLocaleContent.includes("'en-US'"), 'placeholder 必须有英文');
assert.ok(rulesLocaleContent.includes("'zh-CN'"), 'placeholder 必须有中文');
assert.ok(rulesLocaleContent.includes("'ar-SA'"), 'placeholder 必须有阿语');
assert.ok(!content.includes('e.g.'), '页面禁止硬编码 e.g. placeholder');
assert.ok(
!content.includes('US, AE, CN'),
'页面禁止硬编码国家筛选 placeholder'
);
assert.ok(
!content.includes('Gitex Dubai'),
'页面禁止硬编码规则名称 placeholder'
);
});
test('5. 新建规则地理字段必须为空,禁止预选迪拜/阿联酋/示例城市', () => {
const content = fs.readFileSync(rulesPagePath, 'utf-8');
// 新建时必须显式清空 countryCode,不得依赖隐式残留
assert.ok(
/handleOpenCreate[\s\S]*?setFieldsValue\(\{[\s\S]*?countryCode:\s*(undefined|null|['"]{2})/.test(
content
),
'handleOpenCreate 必须显式设置 countryCode 为空 (undefined/null/"")'
);
// 禁止把示例国家/城市写入表单初始值
const bannedGeoAssignments = [
/countryCode:\s*['"]AE['"]/i,
/countryCode:\s*['"]UAE['"]/i,
/countryCode:\s*['"]Dubai['"]/i,
/countryCode:\s*['"]CN['"]/,
/countryCode:\s*['"]US['"]/,
/countryCode:\s*['"]SG['"]/,
/city:\s*['"]Dubai['"]/i,
/city:\s*['"]迪拜['"]/,
];
for (const pattern of bannedGeoAssignments) {
assert.ok(
!pattern.test(content),
`禁止预填地理示例值: ${pattern}`
);
}
// Form.Item countryCode 禁止 defaultValue / initialValue 预选(仅检查该字段自身)
const countryCodeItems =
content.match(
/<Form\.Item[^>]*field=["']countryCode["'][\s\S]*?<\/Form\.Item>/g
) || [];
assert.ok(countryCodeItems.length > 0, '必须存在 countryCode Form.Item');
for (const item of countryCodeItems) {
assert.ok(
!/(defaultValue|initialValue)=["'][^"']+["']/.test(item),
'countryCode Form.Item 禁止 defaultValue/initialValue 预选'
);
}
// 页面源码不得把迪拜/阿联酋当表单默认展示(locale 占位文案不在本文件)
assert.ok(!content.includes('Dubai'), '页面禁止硬编码 Dubai');
assert.ok(!content.includes('迪拜'), '页面禁止硬编码迪拜');
assert.ok(!content.includes('阿联酋'), '页面禁止硬编码阿联酋');
assert.ok(!content.includes('United Arab Emirates'), '页面禁止硬编码 UAE 全称');
// 编辑仅回填接口 countryCode;无值时空串,不得塞示例
assert.ok(
/countryCode:\s*rule\.countryCode\s*\|\|\s*['"]{2}/.test(content),
'编辑必须用 rule.countryCode || "",无接口值则空'
);
// 模拟解析弹窗打开时必须重置地理字段,不得预填
assert.ok(
content.includes('resolveForm.resetFields()'),
'打开解析弹窗必须 resolveForm.resetFields() 清空地理等字段'
);
assert.ok(
/resolveForm\.setFieldsValue\(\{[\s\S]*?countryCode:\s*(undefined|null|['"]{2})/.test(
content
),
'打开解析弹窗必须显式清空 countryCode'
);
// 禁止任何 defaultValue/initialValue 指向示例国家码
assert.ok(
!/(defaultValue|initialValue)=["'](AE|UAE|Dubai|CN|US|SG)["']/i.test(content),
'禁止 defaultValue/initialValue 预选示例国家'
);
});