public static TCPProcessCmdResults ProcessUpdateEverySignCmd(DBManager dbMgr, 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 != 6) { 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]); int add = Convert.ToInt32(fields[1]); string fromDate = fields[2].Replace("$", ":"); string toDate = fields[3].Replace("$", ":"); string activedata = fields[4]; string stage = fields[5]; DBRoleInfo dbUserInfo = dbMgr.GetDBRoleInfo(ref RoleID); string strcmd; if (null == dbUserInfo) { LogManager.WriteLog(LogTypes.Error, string.Format("查找用户数据失败,CMD={0}, UserID={1}", (TCPGameServerCmds)nID, RoleID), null, true); strcmd = string.Format("{0}:{1}", RoleID, -1); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID); return(TCPProcessCmdResults.RESULT_DATA); } string huoDongKeyStr = Global.GetHuoDongKeyString(fromDate, toDate); int ret = DBWriter.AddRegressHongDongAwardRecordForUser(dbMgr, dbUserInfo.UserID, 111, huoDongKeyStr, (long)add, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), activedata, stage); if (ret < 0) { strcmd = string.Format("{0}:{1}", RoleID, -1); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID); return(TCPProcessCmdResults.RESULT_DATA); } strcmd = string.Format("{0}:{1}", RoleID, 1); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID); return(TCPProcessCmdResults.RESULT_DATA); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, "", false, false); } tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); }
public static TCPProcessCmdResults ProcessUpdateSprQueryDayUserActivityInfoCmd(DBManager dbMgr, 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 != 4) { 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]); int activityType = Global.SafeConvertToInt32(fields[1], 10); string SignInfo = fields[2]; string stage = fields[3]; DBRoleInfo roleInfo = dbMgr.GetDBRoleInfo(ref roleID); string strcmd; if (null == roleInfo) { strcmd = string.Format("{0}:{1}:0:0", -1001, roleID); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID); return(TCPProcessCmdResults.RESULT_DATA); } DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); string huoDongKeyStr = Global.GetHuoDongKeyString(startTime.ToString("yyyy-MM-dd HH:mm:ss"), endTime.ToString("yyyy-MM-dd HH:mm:ss")); string lastgettime; int hasgettimes; string activitydata; int ret = DBQuery.GetRegressAwardDayHistoryForUser(dbMgr, roleInfo.UserID, activityType, huoDongKeyStr, stage, out lastgettime, out hasgettimes, out activitydata); if (ret < 0) { lastgettime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); hasgettimes = 0; ret = DBWriter.AddRegressHongDongAwardRecordForUser(dbMgr, roleInfo.UserID, activityType, huoDongKeyStr, (long)hasgettimes, lastgettime, SignInfo, stage); if (ret < 0) { tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); } } ret = DBWriter.UpdateRegressHongDongAwardRecordForUser(dbMgr, roleInfo.UserID, activityType, huoDongKeyStr, (long)hasgettimes, lastgettime, SignInfo, stage); if (ret < 0) { tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); } strcmd = string.Format("{0}:{1}:{2}:{3}", new object[] { roleID, hasgettimes, lastgettime.Replace(":", "$"), activitydata }); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID); return(TCPProcessCmdResults.RESULT_DATA); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, "", false, false); } tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); }