This commit is contained in:
2026-08-17 19:52:04 +08:00
parent d618683467
commit ee4cd35927
42 changed files with 702 additions and 226 deletions
+39
View File
@@ -0,0 +1,39 @@
const categoryLabels: Record<string, string> = {
SYSTEM: '系统通知',
SYSTEM_NOTICE: '系统通知',
BUSINESS: '业务提醒',
BUSINESS_REMINDER: '业务提醒',
ALERT: '异常告警',
EXCEPTION_ALERT: '异常告警',
WARNING: '异常告警',
TASK: '任务待办',
TASK_TODO: '任务待办',
ORDER: '订单消息',
INBOUND: '入库消息',
FINANCE: '财务消息',
CUSTOMS: '报关消息',
ACCEPTANCE: '验收消息',
CLIENT_ACCEPTANCE: '验收消息',
}
const appLabels: Record<string, string> = {
PLATFORM: '管理后台',
ADMIN: '管理后台',
MERCHANT: '企业客户端',
}
const recipientStatusLabels: Record<string, string> = {
RESOLVED: '待投递',
DELIVERED: '已送达',
FAILED: '投递失败',
}
function mappedLabel(value: string | null | undefined, labels: Record<string, string>) {
const code = value?.trim()
if (!code) return '—'
return labels[code.toUpperCase()] ?? code
}
export const notificationCategoryLabel = (value?: string | null) => mappedLabel(value, categoryLabels)
export const notificationAppLabel = (value?: string | null) => mappedLabel(value, appLabels)
export const notificationRecipientStatusLabel = (value?: string | null) => mappedLabel(value, recipientStatusLabels)