From ac2797e1b7347917304bcd36519c731637b5c0bd Mon Sep 17 00:00:00 2001 From: iven Date: Fri, 1 May 2026 17:19:39 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=AD=A3=20#10=20=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=AB=AF=E7=82=B9=E6=8F=8F=E8=BF=B0=20=E2=80=94=20erp?= =?UTF-8?q?-message=20=E6=A8=A1=E5=9D=97=E9=80=9A=E7=9F=A5=E4=BD=93?= =?UTF-8?q?=E7=B3=BB=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-05-01-tri-platform-audit-fix-design.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/superpowers/specs/2026-05-01-tri-platform-audit-fix-design.md b/docs/superpowers/specs/2026-05-01-tri-platform-audit-fix-design.md index 18b4add..ed2e1c3 100644 --- a/docs/superpowers/specs/2026-05-01-tri-platform-audit-fix-design.md +++ b/docs/superpowers/specs/2026-05-01-tri-platform-audit-fix-design.md @@ -549,17 +549,20 @@ onClick={() => { 1. 新建通知 API 服务:`apps/miniprogram/src/services/notification.ts` -后端 `erp-message` 模块目前只有 `GET /api/v1/messages` 和 `PUT /api/v1/messages/{id}/read`,没有独立的通知端点。方案:对接现有消息列表端点,按类型筛选通知类消息。 +后端 `erp-message` 模块通知端点完整:`GET /messages`(列表)、`PUT /messages/{id}/read`(标记已读)、`PUT /messages/read-all`(全部已读)、`GET /messages/unread-count`(未读计数)、`GET /messages/stream`(SSE 实时推送)。事件消费者覆盖 20 种事件类型。直接对接即可。 ```typescript -import { http } from '@/utils/http'; +import { api } from '@/services/request'; export const notificationService = { - // 复用现有消息列表端点,按 category 筛选通知 list: (params?: { page?: number; page_size?: number }) => - http.get('/api/v1/messages', { params: { ...params, category: 'notification' } }), + api.get('/messages', params), markRead: (id: string) => - http.put(`/api/v1/messages/${id}/read`), + api.put(`/messages/${id}/read`), + markAllRead: () => + api.put('/messages/read-all'), + getUnreadCount: () => + api.get('/messages/unread-count'), }; ``` @@ -572,7 +575,7 @@ setNotifications([]); // 修改后 try { const res = await notificationService.list({ page: 1, page_size: 20 }); - setNotifications(res.data?.data || []); + setNotifications(res?.data || []); } catch { setNotifications([]); }