From 09f15d2e03a14293df5934b2049e8d7dcc2a3424 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 7 Nov 2025 15:09:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/mockSocketService.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/services/mockSocketService.js b/src/services/mockSocketService.js index a78faa23..9e69bc94 100644 --- a/src/services/mockSocketService.js +++ b/src/services/mockSocketService.js @@ -683,14 +683,23 @@ class MockSocketService { * @param {object} customData - 自定义消息数据(可选) */ sendTestNotification(customData = null) { - const notification = customData || { - type: 'trade_alert', - severity: 'info', - title: '测试消息', - message: '这是一条手动触发的测试消息', - timestamp: Date.now(), - autoClose: 5000, + // 如果传入自定义数据,直接使用(向后兼容) + if (customData) { + this.emit('new_event', customData); + logger.info('mockSocketService', 'Custom test notification sent', customData); + return; + } + + // 默认发送新格式的测试通知(符合当前通知系统规范) + const notification = { + type: 'announcement', // 公告通知类型 + priority: 'important', // 重要优先级(30秒自动关闭) + title: '🧪 测试通知', + content: '这是一条手动触发的测试消息,用于验证通知系统是否正常工作', + publishTime: Date.now(), + pushTime: Date.now(), id: `test_${Date.now()}`, + clickable: false, }; this.emit('new_event', notification);