feat(通知): task_failed 带 ref_json 定位锚点,明细可点直达任务详情

用户原话「都没体现哪个任务id/店铺/用户,咋排查」:通知表只有 title/content,
失败任务又按「用户×模块×自然日」聚合成一条,明细被 5 个 taskNo 预览 + 512 字截断吃掉。

- V162 给 biz_user_notification 加 ref_json(TEXT,可重跑迁移,存量不回填)
- 扫描器把桶内每个失败任务写成锚点(taskId/taskNo/moduleType/reason/updatedAt/
  deviceId),上限 20 条;品牌任务无 task_no 用 #<id> 兜底,保证至少一条可定位
- 详情接口回传 refs;同键刷新时锚点变化也更新,且不重新点亮已读
- 后台铃铛「展开明细」渲染成可点行,跳任务中心 ?taskNo= 自动开详情抽屉
- 新增判据 taskFailedAdminNotificationCarriesUidAndTaskNoAnchor:管理端正文必须含
  uid、每个桶的 ref_json 至少一条非空 taskNo
This commit is contained in:
2026-10-22 10:28:12 +08:00
parent 78be0f02e2
commit d268ecdf6b
15 changed files with 361 additions and 36 deletions
@@ -13,6 +13,17 @@ export const ADMIN_NOTIFICATION_SEVERITY_LABELS: Readonly<Record<AdminNotificati
low: '低危',
}
/** 通知里的结构化定位锚点(当前只有 task_failed 使用:桶内每个失败任务一项)。 */
export interface AdminNotificationRef {
taskId: number | null
/** 任务号;品牌任务为 #<id>。任务详情接口按它查。 */
taskNo: string
moduleType?: string | null
reason?: string | null
updatedAt?: string | null
deviceId?: string | null
}
/** 单条通知(后台铃铛)。 */
export interface AdminNotificationItem {
id: number
@@ -22,6 +33,8 @@ export interface AdminNotificationItem {
severity?: string
title: string
content: string
/** 可点的定位锚点;旧后端/历史行没有这一列时为空。 */
refs?: AdminNotificationRef[] | null
read: boolean
readAt: string | null
createdAt: string | null