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([]); }