feat(通知): 四级严重度与严重度/时间双排序,客户端与后台管理同步
通知表新增 severity(紧急/高危/中危/低危,V161),由 scene + level 推导且 不回改 level:老客户端配色不受影响,secret_balance 的余量偏低与欠费也能分档。 列表与聚合接口默认按严重度倒序(同档按时间倒序),sort=time 切纯时间排序; 聚合组取组内最高严重度。两端铃铛加彩色等级标签与排序切换,展开明细沿用 同一排序,严重度排序下隐藏会跨天误导的日期头。
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
import { http } from './http'
|
||||
import { unwrap } from './envelope'
|
||||
|
||||
/** 业务严重度:紧急 / 高危 / 中危 / 低危(后端按 scene + level 推导)。 */
|
||||
export type AdminNotificationSeverity = 'urgent' | 'high' | 'medium' | 'low'
|
||||
|
||||
export type AdminNotificationSortMode = 'severity' | 'time'
|
||||
|
||||
export const ADMIN_NOTIFICATION_SEVERITY_LABELS: Readonly<Record<AdminNotificationSeverity, string>> = {
|
||||
urgent: '紧急',
|
||||
high: '高危',
|
||||
medium: '中危',
|
||||
low: '低危',
|
||||
}
|
||||
|
||||
/** 单条通知(后台铃铛)。 */
|
||||
export interface AdminNotificationItem {
|
||||
id: number
|
||||
scene: string
|
||||
level: string
|
||||
/** 业务严重度;旧后端不返回时前端按 level 兜底。 */
|
||||
severity?: string
|
||||
title: string
|
||||
content: string
|
||||
read: boolean
|
||||
@@ -38,6 +52,8 @@ export interface AdminNotificationGroup {
|
||||
rowCount: number
|
||||
unreadCount: number
|
||||
level: string
|
||||
/** 组内最高严重度。 */
|
||||
severity?: string
|
||||
title: string
|
||||
content: string
|
||||
createdAt: string | null
|
||||
@@ -69,6 +85,8 @@ export interface AdminNotificationListParams {
|
||||
keyword?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
/** 排序:severity(默认)或 time;默认值不下发。 */
|
||||
sort?: AdminNotificationSortMode
|
||||
/** 展开聚合组:三个条件取自该组自己返回的值,原样回传。 */
|
||||
scene?: string
|
||||
day?: string
|
||||
@@ -90,6 +108,7 @@ export async function fetchNotificationGroups(
|
||||
keyword: keyword || undefined,
|
||||
startDate: params.startDate || undefined,
|
||||
endDate: params.endDate || undefined,
|
||||
sort: params.sort === 'time' ? 'time' : undefined,
|
||||
},
|
||||
})
|
||||
return unwrap<AdminNotificationGroupPage>(data)
|
||||
@@ -107,6 +126,7 @@ export async function fetchNotificationList(
|
||||
keyword: keyword || undefined,
|
||||
startDate: params.startDate || undefined,
|
||||
endDate: params.endDate || undefined,
|
||||
sort: params.sort === 'time' ? 'time' : undefined,
|
||||
scene: params.scene || undefined,
|
||||
day: params.day || undefined,
|
||||
subjectUserId: params.subjectUserId ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user