diff --git a/src/services/core/wsService.ts b/src/services/core/wsService.ts index 889888e..ec60b94 100644 --- a/src/services/core/wsService.ts +++ b/src/services/core/wsService.ts @@ -619,12 +619,14 @@ class WebSocketService { receiver_id: payload.receiver_id, category: payload.category, system_type: payload.system_type, - extra_data: payload.extra_data, + extra_data: payload.extra_data || payload.extra || payload.data, is_read: !!payload.is_read, created_at: payload.created_at || new Date().toISOString(), }; this.emit('notification', m); - systemNotificationService.handleWSMessage(m as any).catch(() => {}); + if (!m.is_read) { + systemNotificationService.handleWSMessage(m as any).catch(() => {}); + } } // Call signaling handlers diff --git a/src/stores/message/services/WSMessageHandler.ts b/src/stores/message/services/WSMessageHandler.ts index fa4260a..7b3051f 100644 --- a/src/stores/message/services/WSMessageHandler.ts +++ b/src/stores/message/services/WSMessageHandler.ts @@ -131,9 +131,10 @@ export class WSMessageHandler implements IWSMessageHandler { // 监听系统通知,实时更新系统未读数 wsService.on('notification', (message: WSNotificationMessage) => { - if (!message.is_read) { - this.incrementSystemUnread(); + if (message.is_read) { + return; } + this.incrementSystemUnread(); if (message.created_at) { const store = useMessageStore.getState(); const currentLast = store.lastSystemMessageAt;