/// <summary> /// 转发退码命令到出货客户端 /// </summary> /// <param name="sessionId">下注端ID</param> /// <param name="betContent">下注结果信息</param> /// <returns></returns> public static MQActionVoidResult DeleteBet(string sessionId, BetContentResult betContent) { var session = SessionPool.GetClientsGroup(ClientTypeEnum.Bet); if (session != null) { foreach (var item in session) { if (item.Value.platform.Value == betContent.BetPlatformEnum) { MQRouterSendQueue.PushDeleteBet(item.Key, betContent); } } return(new MQActionVoidResult() { IsOK = true }); } else { return(new MQActionVoidResult() { IsOK = false, ErrorMsg = "未找到下注客户端" }); } }
/// <summary> /// 投注端退出了,注销资源,通知他的控盘端下线 /// </summary> public static void RemoveBetServer(Session session) { if (AvailableBetServers.ContainsKey(session.ClientId)) { int value; AvailableBetServers.TryRemove(session.ClientId, out value); } // 通知该服务端影响到的一批客户端下线 var allClients = SessionPool.GetClientsGroup(ClientTypeEnum.Client); if (allClients.Count == 0) { return; } var clientIds = allClients.Keys.ToArray(); foreach (var clientId in clientIds) { if (allClients[clientId].BetServerId == session.ClientId) { MQRouterSendQueue.PushBetServerClose(clientId); } } }
/// <summary> /// 检测客户端是否在线,否则移除sesion /// </summary> /// <param name="activeColor"></param> /// <param name="disableColor"></param> private void CheckHeartbeat_ClientDesk(Color activeColor, Color disableColor) { var clients = SessionPool.GetClientsGroup(ClientTypeEnum.Client); var sessionIds = clients.Keys.ToArray(); int okCount = 0; if (sessionIds.Length > 0) { DateTime checkTime = DateTime.Now.AddSeconds(-20); foreach (var item in sessionIds) { if (clients[item].Heartbeat >= checkTime) { okCount++; } else { // 移除控盘端资源 SessionControler.Disconnect(item, new ValueTypeParam <ClientTypeEnum>(ClientTypeEnum.Client)); } } } if (okCount > 0) { } else { } }
/// <summary> /// 转发扫水结果到客户端 /// </summary> /// <param name="sessionId">发送端</param> /// <param name="content">扫水结果</param> /// <returns></returns> public static MQActionVoidResult CollectCompletedToClient(string sessionId, CollectResult content) { var session = SessionPool.GetClientsGroup(ClientTypeEnum.Client); if (session != null) { foreach (var item in session) { if (item.Key == content.ClientSessionID) { MQRouterSendQueue.PushCollectCompleted(item.Key, content); break; } } return(new MQActionVoidResult() { IsOK = true }); } else { return(new MQActionVoidResult() { IsOK = false, ErrorMsg = "未找到出货客户端" }); } }
private void btnPushMessage_Click(object sender, EventArgs e) { var session = SessionPool.GetClientsGroup(ClientTypeEnum.Bet); if (session != null) { var ses = session.First(); MQRouterSendQueue.PushBetServerClose(ses.Key); } }
private void CheckHeartbeat_CollectOdds(Color activeColor, Color disableColor, DateTime checkTime) { var clientsCollectOdds = SessionPool.GetClientsGroup(ClientTypeEnum.Unknow); // if (clientsCollectOdds.Count > 0 && clientsCollectOdds.First().Value.Heartbeat >= checkTime) { } else { } }
private void CheckHeartbeat_CollectRaceInfo(Color activeColor, Color disableColor, DateTime checkTime) { var clientsCollectRaceInfo = SessionPool.GetClientsGroup(ClientTypeEnum.Sell); if (clientsCollectRaceInfo.Count > 0 && clientsCollectRaceInfo.First().Value.Heartbeat >= checkTime) { } else { } }
private void CheckHeartbeat_CollectDiscount(Color activeColor, Color disableColor, DateTime checkTime) { var clientsCollectDiscount = SessionPool.GetClientsGroup(ClientTypeEnum.Crawl); Dictionary <BetPlatformEnum, bool> isOkWebs = new Dictionary <BetPlatformEnum, bool>(); isOkWebs[BetPlatformEnum.QX1688] = false; isOkWebs[BetPlatformEnum.QXDFV168] = false; isOkWebs[BetPlatformEnum.QXEG6] = false; isOkWebs[BetPlatformEnum.QXS6] = false; if (clientsCollectDiscount.Count > 0) { foreach (var item in clientsCollectDiscount) { if (item.Value.Heartbeat >= checkTime && item.Value.platform.HasValue) { isOkWebs[item.Value.platform.Value] = true; } } } if (isOkWebs[BetPlatformEnum.QX1688]) { } else { } if (isOkWebs[BetPlatformEnum.QXDFV168]) { } else { } if (isOkWebs[BetPlatformEnum.QXEG6]) { } else { } if (isOkWebs[BetPlatformEnum.QXS6]) { } else { } }
/// <summary> /// 转发下注命令到出货客户端 /// </summary> /// <param name="sessionId">下注端ID</param> /// <param name="betContent">下注结果信息</param> /// <returns></returns> public static MQActionVoidResult BetCompleted(string sessionId, BetContentResult betContent) { var session = SessionPool.GetClientsGroup(ClientTypeEnum.Strategy); if (session != null) { foreach (var item in session) { MQRouterSendQueue.PushAddBetCompleted(item.Key, betContent); } return(new MQActionVoidResult() { IsOK = true }); } else { return(new MQActionVoidResult() { IsOK = false, ErrorMsg = "未找到下注客户端" }); } }
/// <summary> /// 转发扫水命令到扫水客户端 /// </summary> /// <param name="sessionId">命令发送端</param> /// <param name="betContent">扫水内容</param> /// <returns></returns> public static MQActionVoidResult SendCollect(string sessionId, Collect content) { var session = SessionPool.GetClientsGroup(ClientTypeEnum.Crawl); if (session != null) { foreach (var item in session) { MQRouterSendQueue.SendCollect(item.Key, content); } return(new MQActionVoidResult() { IsOK = true }); } else { return(new MQActionVoidResult() { IsOK = false, ErrorMsg = "未找到扫水客户端" }); } }