修复商城订单列表展示与模拟数据
This commit is contained in:
@@ -102,6 +102,41 @@ for (const [key, label] of [
|
||||
}
|
||||
}
|
||||
|
||||
// 商城订单必须遵循独立交易状态,并以名称展示用户关系。
|
||||
const orderDefinition = resources.match(
|
||||
/define\('ec_order',[\s\S]*?\n\s*\]\),/,
|
||||
)?.[0];
|
||||
if (!orderDefinition) throw new Error('无法读取商城订单资源定义');
|
||||
for (const [value, label] of [
|
||||
[16, '待支付'],
|
||||
[18, '已支付'],
|
||||
[22, '已取消'],
|
||||
]) {
|
||||
if (!orderDefinition.includes(`{ label: '${label}', value: ${value} }`)) {
|
||||
throw new Error(`商城订单状态 ${value} 缺少中文展示:${label}`);
|
||||
}
|
||||
}
|
||||
const orderUserField = orderDefinition.match(
|
||||
/relation\('user_account_identity'[\s\S]*?\}\)/,
|
||||
)?.[0];
|
||||
if (
|
||||
!orderUserField ||
|
||||
!orderUserField.includes("listLabel: '用户'") ||
|
||||
!orderUserField.includes('listRelationNameOnly: true') ||
|
||||
!orderUserField.includes('displayRelationLabel: true') ||
|
||||
!orderUserField.includes('showIdentityCopy: true')
|
||||
) {
|
||||
throw new Error('商城订单用户列必须以用户名称展示并保留唯一标识复制入口');
|
||||
}
|
||||
for (const invalidStatus of [10, 35]) {
|
||||
if (orderDefinition.includes(`value: ${invalidStatus}`)) {
|
||||
throw new Error(`商城订单不得把跨领域通用状态 ${invalidStatus} 当作有效交易状态`);
|
||||
}
|
||||
}
|
||||
if (!orderDefinition.includes("f('paid_at', { emptyText: '未支付' })")) {
|
||||
throw new Error('商城订单空支付时间必须明确显示为未支付');
|
||||
}
|
||||
|
||||
if (/title="ID"|data-index="id"/.test(listPage)) {
|
||||
throw new Error('标准资源列表不得把数据库ID作为业务列展示');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user