修复工单Bug
This commit is contained in:
1 parent
7982f7e348
commit
8e0cc20649
12 files changed
+602
-236
No files matched your search
@@ -40,7 +40,7 @@ public sealed class TicketRealtimeMonitor : IDisposable
|
||||
/// <summary>
|
||||
/// 供工单页复用的实时服务,避免重复建立 SSE 连接。
|
||||
/// </summary>
|
||||
public ITicketRealtimeService RealtimeService { get; }
|
||||
public EventSourceTicketRealtimeService RealtimeService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 收到新的工单留言通知时触发。
|
||||
@@ -132,6 +132,38 @@ public sealed class TicketRealtimeMonitor : IDisposable
|
||||
RaiseUnreadCountChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合并历史未读数据。与实时事件产生的未读取较大值,避免重复计数。
|
||||
/// </summary>
|
||||
/// <param name="unreadByTicket">
|
||||
/// 键为 "appId|wechatOrderId",值为该工单的未读消息数。
|
||||
/// </param>
|
||||
public void MergeUnread(IDictionary<string, int> unreadByTicket)
|
||||
{
|
||||
if (unreadByTicket == null || unreadByTicket.Count == 0)
|
||||
return;
|
||||
|
||||
var changed = false;
|
||||
lock (_sync)
|
||||
{
|
||||
foreach (var item in unreadByTicket)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(item.Key) || item.Value <= 0)
|
||||
continue;
|
||||
|
||||
_unreadMessages.TryGetValue(item.Key, out var current);
|
||||
if (item.Value <= current)
|
||||
continue;
|
||||
|
||||
_unreadMessages[item.Key] = item.Value;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
RaiseUnreadCountChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空全部未读提示。
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user