public JieriPlatChargeKingEverydayData BuildQueryDataForClient(GameClient client) { DateTime startTime = DateTime.Parse(this.FromDate); DateTime endTime = DateTime.Parse(this.ToDate); DateTime now = TimeUtil.NowDateTime(); JieriPlatChargeKingEverydayData myData = new JieriPlatChargeKingEverydayData(); bool needHasGetTimes = false; lock (this.Mutex) { myData.PaiHangDict = new Dictionary <int, List <InputKingPaiHangData> >(this._realRankDict); foreach (KeyValuePair <int, List <InputKingPaiHangData> > kvp in myData.PaiHangDict) { if (!(now < startTime.AddDays((double)kvp.Key))) { needHasGetTimes = kvp.Value.Exists((InputKingPaiHangData x) => 0 == string.Compare(x.UserID, client.strUserID, true)); if (needHasGetTimes) { break; } } } } if (needHasGetTimes) { string huoDongKeyStr = Global.GetHuoDongKeyString(this.FromDate, this.ToDate); myData.hasgettimes = KFCopyRpcClient.getInstance().QueryHuodongAwardUserHist(77, huoDongKeyStr, client.strUserID); } return(myData); }
public TCPProcessCmdResults ProcessQueryJieRiMeiRiPlatChargeKingCmd(TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPRandKey tcpRandKey, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket) { tcpOutPacket = null; string cmdData = null; try { cmdData = new UTF8Encoding().GetString(data, 0, count); } catch (Exception) { LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}", (TCPGameServerCmds)nID), null, true); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); } try { string[] fields = cmdData.Split(new char[] { ':' }); if (fields.Length != 1) { LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Recv={1}, CmdData={2}", (TCPGameServerCmds)nID, fields.Length, cmdData), null, true); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); } int roleID = Convert.ToInt32(fields[0]); GameClient client = GameManager.ClientMgr.FindClient(socket); if (KuaFuManager.getInstance().ClientCmdCheckFaild(nID, client, ref roleID)) { LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket, false), roleID), null, true); return(TCPProcessCmdResults.RESULT_FAILED); } JieriPlatChargeKingEverydayData myData = null; JieriPlatChargeKingEveryDay act = HuodongCachingMgr.GetJieriPCKingEveryDayActivity(); if (act != null) { myData = act.BuildQueryDataForClient(client); } tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, DataHelper.ObjectToBytes <JieriPlatChargeKingEverydayData>(myData), nID); return(TCPProcessCmdResults.RESULT_DATA); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, "", false, false); } tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); }