public async Task Handle(OnlinePushEvent p_event) { StringCache sc = new StringCache(p_event.PrefixKey); if (p_event.Receivers != null && p_event.Receivers.Count > 0) { foreach (var id in p_event.Receivers) { if (Online.All.TryGetValue(id, out var ls) && ls != null && ls.Count > 0) { // 在线推送,直接放入推送队列 if (p_event.PushFirstSession) { ls[0].AddMsg(p_event.Msg); await sc.Set(null, true); } else { foreach (var ci in ls) { ci.AddMsg(p_event.Msg); } // 设置处理标志: msg:Push:6位id前缀:userid = true await sc.Set(id, true); } } } } // 统计总数+1 await sc.Increment("cnt"); }
public async Task Handle(IsOnlineEvent p_event) { var sc = new StringCache(p_event.CacheKey); var ls = Online.GetSessions(p_event.UserID); if (ls != null && ls.Count > 0) { await sc.Set(null, "true"); } // 统计总数+1 await sc.Increment("cnt"); }
public async Task Handle(UnregisterEvent p_event) { var sc = new StringCache(p_event.CacheKey); var ci = Online.GetSession(p_event.UserID, p_event.SessionID); if (ci != null) { await sc.Set(null, "true"); await ci.Close(); } // 统计总数 await sc.Increment("cnt"); }