feat: 添加本地通知测试
This commit is contained in:
@@ -683,14 +683,23 @@ class MockSocketService {
|
|||||||
* @param {object} customData - 自定义消息数据(可选)
|
* @param {object} customData - 自定义消息数据(可选)
|
||||||
*/
|
*/
|
||||||
sendTestNotification(customData = null) {
|
sendTestNotification(customData = null) {
|
||||||
const notification = customData || {
|
// 如果传入自定义数据,直接使用(向后兼容)
|
||||||
type: 'trade_alert',
|
if (customData) {
|
||||||
severity: 'info',
|
this.emit('new_event', customData);
|
||||||
title: '测试消息',
|
logger.info('mockSocketService', 'Custom test notification sent', customData);
|
||||||
message: '这是一条手动触发的测试消息',
|
return;
|
||||||
timestamp: Date.now(),
|
}
|
||||||
autoClose: 5000,
|
|
||||||
|
// 默认发送新格式的测试通知(符合当前通知系统规范)
|
||||||
|
const notification = {
|
||||||
|
type: 'announcement', // 公告通知类型
|
||||||
|
priority: 'important', // 重要优先级(30秒自动关闭)
|
||||||
|
title: '🧪 测试通知',
|
||||||
|
content: '这是一条手动触发的测试消息,用于验证通知系统是否正常工作',
|
||||||
|
publishTime: Date.now(),
|
||||||
|
pushTime: Date.now(),
|
||||||
id: `test_${Date.now()}`,
|
id: `test_${Date.now()}`,
|
||||||
|
clickable: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.emit('new_event', notification);
|
this.emit('new_event', notification);
|
||||||
|
|||||||
Reference in New Issue
Block a user