/// <summary> /// 查询停封玩家信息 /// </summary> /// <param name="index">第几页</param> /// <param name="pageSize">每页记录数</param> /// <returns></returns> public Message Soccer_AccountState_Query(int index, int pageSize) { System.Data.DataSet ds = null; string serverIP = null; string str_type = ""; string str_string = ""; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_ServerIP).m_bValueBuffer); str_type = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_Type).m_bValueBuffer); str_string = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_String).m_bValueBuffer); SqlHelper.log.WriteLog(lg.API_Display + lg.Soccer_Soccer + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.Soccer_CharacterInfoAPI_Account + str_string + lg.Soccer_CharacterInfoAPI_BanInfo); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.Soccer_Soccer + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.Soccer_CharacterInfoAPI_Account + str_string + lg.Soccer_CharacterInfoAPI_BanInfo); ds = SOCCERCharacterInfo.Soccer_AccountState_Query(serverIP, str_type, str_string); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.Soccer_loginId, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.Soccer_regDate, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[2])); strut.AddTagKey(TagName.Soccer_m_id, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_ACCOUNTSTATE_QUERY_RESP, 4)); } else { return(Message.COMMON_MES_RESP(lg.Soccer_CharacterInfoAPI_NoBan, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_ACCOUNTSTATE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP(ex.Message, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_ACCOUNTSTATE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 查看玩家身上道具 /// </summary> /// <returns></returns> public Message itemShop_Owner_Query() { string serverIP = null; string userID = null; DataSet ds = null; try { serverIP = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_ServerIP).m_bValueBuffer); userID = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_UserID).m_bValueBuffer); SqlHelper.log.WriteLog(lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + userID + lg.O2JAM2API_ItemShopAPI_AllBodyItem); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + userID + lg.O2JAM2API_ItemShopAPI_AllBodyItem); //请求玩家身上的道具 ds = ItemShopInfo.AvatarItemList_Query(serverIP, userID); if (ds != null && ds.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); //道具编号 byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0]); strut.AddTagKey(TagName.O2JAM2_ItemCode, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具名 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.O2JAM2_ItemName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //最小等级 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.O2JAM2_Level, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具位置 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[3]); strut.AddTagKey(TagName.O2JAM2_Position, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具使用次数 int timelimits = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4]); if (timelimits == -1) { timelimits = 0; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, timelimits); strut.AddTagKey(TagName.O2JAM2_Timeslimt, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具时间限制 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.O2JAM2_DateLimit, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); structList[i] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_AVATORLIST_QUERY_RESP, 6)); } else { return(Message.COMMON_MES_RESP(lg.O2JAM2API_ItemShopAPI_NoBodyItem, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_AVATORLIST_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(lg.O2JAM2API_AccountInfoAPI_NoAccount, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_AVATORLIST_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 玩家上线、下线时间查询 /// </summary> /// <returns></returns> public Message CR_Login_Logout_Query() { System.Data.DataSet ds = null; string serverIP = null; string userID = ""; string nickName = ""; int actionType = 0; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ServerIP).m_bValueBuffer); TLV_Structure strut1 = new TLV_Structure(TagName.CR_ACTION, 4, msg.m_packet.m_Body.getTLVByTag(TagName.CR_ACTION).m_bValueBuffer); actionType = (int)strut1.toInteger(); if (actionType == 1) { userID = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_UserID).m_bValueBuffer); } else if (actionType == 2) { nickName = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_NickName).m_bValueBuffer); } SqlHelper.log.WriteLog(lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_AccountInfoAPI_Account + userID + lg.CR_CharacterInfoAPI_OnlineStatus); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_AccountInfoAPI_Account + userID + lg.CR_CharacterInfoAPI_OnlineStatus); ds = CRCharacterInfo.CR_Login_Logout_Query(serverIP, userID, nickName, actionType); if (ds != null && ds.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.CR_UserName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.CR_NickName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[2])); strut.AddTagKey(TagName.CR_Last_Login, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.CR_Last_Logout, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.CR_Last_Playing_Time, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[5])); strut.AddTagKey(TagName.CR_Total_Time, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); structList[i] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.CR_ADMIN, ServiceKey.CR_LOGIN_LOGOUT_QUERY_RESP, 6)); } else { return(Message.COMMON_MES_RESP(lg.CR_AccountInfoAPI_NoAccount, Msg_Category.CR_ADMIN, ServiceKey.CR_LOGIN_LOGOUT_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception) { return(Message.COMMON_MES_RESP(lg.CR_AccountInfoAPI_NoAccount, Msg_Category.CR_ADMIN, ServiceKey.CR_LOGIN_LOGOUT_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 查询所有的技能道具 /// </summary> /// <returns></returns> public Message Soccer_Item_Skill_Blur_Query() { System.Data.DataSet ds = null; int item_type = 1; string Content = null; try { SqlHelper.log.WriteLog("劲爆足球+>" + "查询所有道具!"); Console.WriteLine(DateTime.Now + " - 劲爆足球+>服务器地址" + "查询所有道具!"); Content = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_content).m_bValueBuffer); ds = SOCCERItemShopInfo.Soccer_Item_Skill_Blur_Query(item_type, Content); if (ds != null && ds.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut1 = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0])); strut1.AddTagKey(TagName.Soccer_idx, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut1.AddTagKey(TagName.Soccer_i_name, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[2])); strut1.AddTagKey(TagName.Soccer_body_part, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[3])); strut1.AddTagKey(TagName.Soccer_item_type, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); structList[i] = strut1; } return(Message.COMMON_MES_RESP(structList, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_ITEM_SKILL_BLUR_QUERY_RESP, 4)); } else { return(Message.COMMON_MES_RESP("没有道具列表!", Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_ITEM_SKILL_BLUR_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP("没有道具列表!", Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_ITEM_SKILL_BLUR_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 玩家资料信息查询 /// </summary> /// <returns></returns> public Message CR_CharacterInfo_Query() { System.Data.DataSet ds = null; string serverIP = null; string account = ""; string nickName = ""; int actionType = 0; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ServerIP).m_bValueBuffer); TLV_Structure strut1 = new TLV_Structure(TagName.CR_ACTION, 4, msg.m_packet.m_Body.getTLVByTag(TagName.CR_ACTION).m_bValueBuffer); actionType = (int)strut1.toInteger(); if (actionType == 1) { account = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ACCOUNT).m_bValueBuffer); } else if (actionType == 2) { nickName = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_NickName).m_bValueBuffer); } SqlHelper.log.WriteLog(lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_AccountInfoAPI_Account + account + lg.CR_AccountInfoAPI_AccountInfo); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_AccountInfoAPI_Account + account + lg.CR_AccountInfoAPI_AccountInfo); ds = CRCharacterInfo.CR_CharacterInfo_Query(serverIP, account, nickName, actionType); if (ds != null && ds.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[0].ItemArray[0])); strut.AddTagKey(TagName.CR_ACCOUNT, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[0].ItemArray[1])); strut.AddTagKey(TagName.CR_NickName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[2])); strut.AddTagKey(TagName.CR_PSTID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[3])); strut.AddTagKey(TagName.CR_EXP, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[4])); strut.AddTagKey(TagName.CR_Money, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[5])); strut.AddTagKey(TagName.CR_RMB, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[6])); strut.AddTagKey(TagName.CR_SEX, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[7])); strut.AddTagKey(TagName.CR_License, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[8])); strut.AddTagKey(TagName.CR_RaceTotal, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[9])); strut.AddTagKey(TagName.CR_RaceWon, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[10])); strut.AddTagKey(TagName.CR_ExpOrder, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[11])); strut.AddTagKey(TagName.CR_WinRateOrder, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[12])); strut.AddTagKey(TagName.CR_WinNumOrder, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); structList[i] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.CR_ADMIN, ServiceKey.CR_CHARACTERINFO_QUERY_RESP, 13)); } else { return(Message.COMMON_MES_RESP(lg.CR_AccountInfoAPI_NoAccount, Msg_Category.CR_ADMIN, ServiceKey.CR_CHARACTERINFO_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception) { return(Message.COMMON_MES_RESP(lg.CR_AccountInfoAPI_NoAccount, Msg_Category.CR_ADMIN, ServiceKey.CR_CHARACTERINFO_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 查看该玩家是否被激活 /// </summary> /// <returns></returns> public Message O2JAM2_AccountActive_Query() { System.Data.DataSet result = null; int status = -1; string serverIP = null; string account = null; string passwd = null; string number = null; try { //serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ServerIP).m_bValueBuffer); // account = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ACCOUNT).m_bValueBuffer); passwd = account = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_Id2).m_bValueBuffer); number = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_Id1).m_bValueBuffer); SqlHelper.log.WriteLog(lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + account + lg.O2JAM2API_AccountInfoAPI_ActiveState); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + account + lg.O2JAM2API_AccountInfoAPI_ActiveState); result = AccountInfo.O2JAM2_AccountActive_Query(account, passwd, number); if (result != null && result.Tables[0].Rows.Count > 0) { //密码错误 if (!result.Tables[0].Rows[0].ItemArray[3].Equals(passwd)) { status = 2; byte[] bgMsg_Status = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, status); TLV_Structure Msg_Status = new TLV_Structure(TagName.O2JAM2_Status, (uint)bgMsg_Status.Length, bgMsg_Status); byte[] baMsg_Pass = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, result.Tables[0].Rows[0].ItemArray[3]); TLV_Structure Msg_Pass = new TLV_Structure(TagName.O2JAM2_Id2, (uint)baMsg_Pass.Length, baMsg_Pass); Packet_Body body = new Packet_Body(new TLV_Structure[] { Msg_Status, Msg_Pass }, 2); Packet_Head head = new Packet_Head(SeqID_Generator.Instance().GetNewSeqID(), Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, body.m_uiBodyLen); return(new Message(new Packet(head, body))); } //激活码未被使用过 else if (Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[5].ToString()) == 0) { status = 3; return(Message.COMMON_MES_RESP(status, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.CR_STATUS, TagFormat.TLV_INTEGER)); } // 激活码已被使用 else if (Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[5].ToString()) == 1) { status = 4; byte[] bgMsg_Status = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, status); TLV_Structure Msg_Status = new TLV_Structure(TagName.O2JAM2_Status, (uint)bgMsg_Status.Length, bgMsg_Status); byte[] baMsg_Account = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[1])); TLV_Structure Msg_Account = new TLV_Structure(TagName.O2JAM2_UserName, (uint)baMsg_Account.Length, baMsg_Account); Packet_Body body = new Packet_Body(new TLV_Structure[] { Msg_Status, Msg_Account }, 2); Packet_Head head = new Packet_Head(SeqID_Generator.Instance().GetNewSeqID(), Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, body.m_uiBodyLen); return(new Message(new Packet(head, body))); } else { return(Message.COMMON_MES_RESP(1, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } /*// 查询帐号未被激活 * else if (!result.Tables[0].Rows[0].ItemArray[3].Equals(account)) * { * status = 5; * } * // 查询帐号已被激活 * else if (result.Tables[0].Rows[0].ItemArray[3].Equals(account)) * { * status = 6; * }*/ } return(Message.COMMON_MES_RESP(1, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } catch (System.Exception) { return(Message.COMMON_MES_RESP(1, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNTACTIVE_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } }
/// <summary> /// 查看该玩家的帐号信息 /// </summary> /// <returns></returns> public Message O2JAM2_Account_Query() { System.Data.DataSet result = null; string serverIP = null; string account = ""; string userNick = ""; int action = 0; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_ServerIP).m_bValueBuffer); TLV_Structure tlv = new TLV_Structure(TagName.O2JAM2_UserID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_UserID).m_bValueBuffer); action = (int)tlv.toInteger(); if (action == 1) { account = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_UserID).m_bValueBuffer); } else if (action == 2) { userNick = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.O2JAM2_UserName).m_bValueBuffer); } SqlHelper.log.WriteLog(lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + account + lg.O2JAM2API_AccountInfoAPI_AccountInfo); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.O2JAM2API_BAF + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.O2JAM2API_AccountInfoAPI_Account + account + lg.O2JAM2API_AccountInfoAPI_AccountInfo); result = AccountInfo.O2JAM2_Account_Query(serverIP, account, userNick, action); if (result != null && result.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[result.Tables[0].Rows.Count]; for (int i = 0; i < result.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure(9); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[0])); strut.AddTagKey(TagName.CR_PSTID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes);; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[1])); strut.AddTagKey(TagName.CR_Passord, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[2])); strut.AddTagKey(TagName.CR_UserID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[3])); strut.AddTagKey(TagName.CR_ACCOUNT, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[4])); strut.AddTagKey(TagName.CR_NickName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(result.Tables[0].Rows[0].ItemArray[5])); //strut.AddTagKey(TagName.CR_SEX, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[6])); strut.AddTagKey(TagName.O2JAM2_Id2, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); // bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(result.Tables[0].Rows[0].ItemArray[7])); //strut.AddTagKey(TagName.O2JAM2_ServerIP, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(result.Tables[0].Rows[0].ItemArray[8])); strut.AddTagKey(TagName.O2JAM2_Rdate, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); structList[i] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNT_QUERY_RESP, 9)); } else { return(Message.COMMON_MES_RESP(lg.O2JAM2API_AccountInfoAPI_NoAccount, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNT_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception) { return(Message.COMMON_MES_RESP(0, Msg_Category.O2JAM2_ADMIN, ServiceKey.O2JAM2_ACCOUNT_QUERY_RESP, TagName.O2JAM2_Status, TagFormat.TLV_INTEGER)); } }
/// <summary> /// 查询玩家购买记录,赠送记录 /// </summary> /// <param name="index">第几页<</param> /// <param name="pageSize">每页记录数</param> /// <returns></returns> public Message Soccer_UserTrade_Query(int index, int pageSize) { System.Data.DataSet ds = null; string serverIP = null; string SenderUserName = null; string ReceiveUserName = null; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_ServerIP).m_bValueBuffer); SenderUserName = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_SenderUserName).m_bValueBuffer); ReceiveUserName = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_ReceiveUserName).m_bValueBuffer); SqlHelper.log.WriteLog("劲爆足球+>服务器地址" + CommonInfo.serverIP_Query(serverIP) + "玩家" + SenderUserName + "购买记录!"); Console.WriteLine(DateTime.Now + " - 劲爆足球+>服务器地址" + CommonInfo.serverIP_Query(serverIP) + "玩家" + SenderUserName + "购买记录!"); ds = SOCCERItemShopInfo.Soccer_UserTrade_Query(serverIP, SenderUserName, ReceiveUserName); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.Soccer_account_idx, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.Soccer_charname, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[2])); strut.AddTagKey(TagName.Soccer_i_name, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.Soccer_item_type, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.Soccer_item_equip, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[5])); strut.AddTagKey(TagName.Soccer_c_date, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[6])); strut.AddTagKey(TagName.Soccer_deleted_date, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[7])); strut.AddTagKey(TagName.Soccer_ReceiveUserName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[8])); strut.AddTagKey(TagName.Soccer_idx, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[9])); strut.AddTagKey(TagName.Soccer_charidx, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[10])); strut.AddTagKey(TagName.Soccer_charname, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_USERTRADE_QUERY_RESP, 12)); } else { return(Message.COMMON_MES_RESP("没有该玩家的购买记录!", Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_USERTRADE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP("没有该玩家的购买记录!", Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_USERTRADE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
public Message Notes_TransmitInfo_Resp(int userByID, int index, int pageSize) { GMLogAPI logAPI = new GMLogAPI(); System.Data.DataSet ds; try { logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_NotesInfoAPI_NotesTransEmailList, LanguageAPI.API_Display + LanguageAPI.API_NotesInfoAPI_NotesTransEmailList); logAPI.writeContent(LanguageAPI.API_NotesInfoAPI_EmailID, LanguageAPI.API_NotesInfoAPI_EmailSubject, LanguageAPI.API_NotesInfoAPI_EmailContent, LanguageAPI.API_NotesInfoAPI_EmailSender); ds = GMNotesInfo.SelectTransmitLetter(userByID); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); //邮件ID strut.AddTagKey(TagName.Letter_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); //邮件发件人 byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.Letter_Sender, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件收件人 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.Letter_Receiver, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件主题 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.Letter_Subject, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件内容 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.Letter_Text, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //发送日期 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.Send_Date, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //处理日期 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[7]); strut.AddTagKey(TagName.Process_Date, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //处理标志 strut.AddTagKey(TagName.Is_Process, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[9])); //处理人姓名 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[11]); strut.AddTagKey(TagName.RealName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //处理理由 object reason; if (ds.Tables[0].Rows[i].IsNull(10) == false) { reason = ds.Tables[0].Rows[i].ItemArray[10]; } else { reason = ""; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, reason); strut.AddTagKey(TagName.Process_Reason, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; logAPI.writeData(Convert.ToString(ds.Tables[0].Rows[i].ItemArray[0]), ds.Tables[0].Rows[i].ItemArray[3].ToString(), ds.Tables[0].Rows[i].ItemArray[4].ToString(), ds.Tables[0].Rows[i].ItemArray[1].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSMIT_RESP, 11)); } else { return(Message.COMMON_MES_RESP(LanguageAPI.API_NotesInfoAPI_NoTransDealWithEmail, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSMIT_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP(LanguageAPI.API_NotesInfoAPI_NoTransDealWithEmail, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSMIT_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
public Message CR_CallBoard_Query(int index, int pageSize) { string serverIP = null; DateTime validTime; int publicID = 0; int valid = 0; int action = 0; System.Data.DataSet ds = null; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ServerIP).m_bValueBuffer); TLV_Structure tlv = new TLV_Structure(TagName.CR_ValidTime, 6, msg.m_packet.m_Body.getTLVByTag(TagName.CR_ValidTime).m_bValueBuffer); validTime = tlv.toTimeStamp(); tlv = new TLV_Structure(TagName.CR_PublishID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.CR_PublishID).m_bValueBuffer); publicID = (int)tlv.toInteger(); //tlv = new TLV_Structure(TagName.CR_Valid, 4, msg.m_packet.m_Body.getTLVByTag(TagName.CR_Valid).m_bValueBuffer); //valid = (int) tlv.toInteger(); tlv = new TLV_Structure(TagName.CR_ACTION, 4, msg.m_packet.m_Body.getTLVByTag(TagName.CR_ACTION).m_bValueBuffer); action = (int)tlv.toInteger(); SqlHelper.log.WriteLog(lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_CallBoardAPI_AllNoticeInfo); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_CallBoardAPI_AllNoticeInfo); ds = CRCallBoardInfo.CallBoardInfo_Query(serverIP, validTime, publicID, valid, action); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 3); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.CR_BoardID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); string context = ""; string context1 = ""; string context2 = ""; if (ds.Tables[0].Rows[i].IsNull(1) == false) { if ((ds.Tables[0].Rows[i].ItemArray[1].ToString().Length / 150) > 2) { context = ds.Tables[0].Rows[i].ItemArray[1].ToString().Substring(0, 150); context1 = ds.Tables[0].Rows[i].ItemArray[1].ToString().Substring(150, 150); context2 = ds.Tables[0].Rows[i].ItemArray[1].ToString().Substring(300, ds.Tables[0].Rows[i].ItemArray[1].ToString().Length - 300); } else if ((ds.Tables[0].Rows[i].ItemArray[1].ToString().Length / 150) > 1) { context = ds.Tables[0].Rows[i].ItemArray[1].ToString().Substring(0, 150); context1 = ds.Tables[0].Rows[i].ItemArray[1].ToString().Substring(150, ds.Tables[0].Rows[i].ItemArray[1].ToString().Length - 150); } else { context = ds.Tables[0].Rows[i].ItemArray[1].ToString(); } } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, context); strut.AddTagKey(TagName.CR_BoardContext, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, context1); strut.AddTagKey(TagName.CR_BoardContext1, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, context2); strut.AddTagKey(TagName.CR_BoardContext2, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[2])); strut.AddTagKey(TagName.CR_BoardColor, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.CR_PublishID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.CR_DayLoop, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[5])); strut.AddTagKey(TagName.CR_ValidTime, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[6])); strut.AddTagKey(TagName.CR_InValidTime, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[7])); strut.AddTagKey(TagName.CR_SPEED, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //状态 int status = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[8]); if (status == -1) { status = 0; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, status); strut.AddTagKey(TagName.CR_STATUS, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //生效格式 int expire = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[9]); if (expire <= 0) { expire = 1; } else { expire = 0; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, expire); strut.AddTagKey(TagName.CR_Expire, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.CR_ADMIN, ServiceKey.CR_CALLBOARD_QUERY_RESP, 13)); } else { return(Message.COMMON_MES_RESP(lg.CR_CallBoardAPI_NoNoticeInfo, Msg_Category.CR_ADMIN, ServiceKey.CR_CALLBOARD_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(lg.CR_CallBoardAPI_NoNoticeInfo, Msg_Category.CR_ADMIN, ServiceKey.CR_CALLBOARD_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
public Message CR_CallBoard_QueryAll(int index, int pageSize) { string serverIP = null; System.Data.DataSet ds = null; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CR_ServerIP).m_bValueBuffer); SqlHelper.log.WriteLog(lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_CallBoardAPI_AllNoticeInfo); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.CR_CR + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.CR_CallBoardAPI_AllNoticeInfo); ds = CRCallBoardInfo.CallBoardInfo_QueryAll(serverIP); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.CR_BoardID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.CR_BoardContext, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[2])); strut.AddTagKey(TagName.CR_BoardColor, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.CR_PublishID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.CR_DayLoop, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[5])); strut.AddTagKey(TagName.CR_ValidTime, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[6])); strut.AddTagKey(TagName.CR_InValidTime, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[7])); strut.AddTagKey(TagName.CR_SPEED, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //状态 int status = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[8]); if (status == -1) { status = 0; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, status); strut.AddTagKey(TagName.CR_STATUS, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //生效格式 int expire = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[9]); if (expire == -1) { expire = 0; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, expire); strut.AddTagKey(TagName.CR_Expire, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.CR_ADMIN, ServiceKey.CR_CALLBOARD_QUERY_RESP, 11)); } else { return(Message.COMMON_MES_RESP(lg.CR_CallBoardAPI_NoNoticeInfo, Msg_Category.CR_ADMIN, ServiceKey.CR_CALLBOARD_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (Common.Logic.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(lg.CR_CallBoardAPI_NoNoticeInfo, Msg_Category.CR_ADMIN, ServiceKey.CR_CALLBOARD_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 查询用户信息 /// </summary> /// <returns></returns> public Message Soccer_Characterinfo_Query() { System.Data.DataSet ds = null; string serverIP = null; string str_type = ""; string str_string = ""; try { serverIP = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_ServerIP).m_bValueBuffer); str_type = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_Type).m_bValueBuffer); str_string = System.Text.Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.Soccer_String).m_bValueBuffer); SqlHelper.log.WriteLog(lg.API_Display + lg.Soccer_Soccer + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.Soccer_CharacterInfoAPI_Account + str_string + lg.Soccer_CharacterInfoAPI_AccountInfo); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.Soccer_Soccer + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.Soccer_CharacterInfoAPI_Account + str_string + lg.Soccer_CharacterInfoAPI_AccountInfo); ds = SOCCERCharacterInfo.Soccer_Characterinfo_Query(serverIP, str_type, str_string); if (ds != null && ds.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.Soccer_loginId, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.Soccer_charidx, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[2])); strut.AddTagKey(TagName.Soccer_charname, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.Soccer_charsex, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.Soccer_charpos, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[5])); strut.AddTagKey(TagName.Soccer_charpoint, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[6])); strut.AddTagKey(TagName.Soccer_charlevel, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[7])); strut.AddTagKey(TagName.Soccer_charexp, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[8])); strut.AddTagKey(TagName.Soccer_match, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[9])); strut.AddTagKey(TagName.Soccer_win, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[10])); strut.AddTagKey(TagName.Soccer_lose, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[11])); strut.AddTagKey(TagName.Soccer_drop, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[12])); strut.AddTagKey(TagName.Soccer_draw, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); structList[i] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_CHARACTERINFO_QUERY_RESP, 13)); } else { return(Message.COMMON_MES_RESP(lg.Soccer_CharacterInfoAPI_NoAccount, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_CHARACTERINFO_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP(ex.Message, Msg_Category.SOCCER_ADMIN, ServiceKey.SOCCER_CHARACTERINFO_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 玩家充值记录信息 /// </summary> /// <returns></returns> public Message CardDetailInfo_Query(int index, int pageSize) { string account = null; string cardID = null; string cardPwd = null; int actionType = 0; string msg1 = null; System.Data.DataSet ds = null; try { account = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CARD_username).m_bValueBuffer); cardID = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CARD_cardnum).m_bValueBuffer); cardPwd = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.CARD_cardpass).m_bValueBuffer); TLV_Structure tlvStrut = new TLV_Structure(TagName.CARD_ActionType, 4, msg.m_packet.m_Body.getTLVByTag(TagName.CARD_ActionType).m_bValueBuffer); actionType = (int)tlvStrut.toInteger(); if (actionType == 1) { msg1 = lg.CardDetail_OneCard; } else { msg1 = lg.CardDetail_LeisureCard; } SqlHelper.log.WriteLog(lg.API_Display + lg.NineYou + lg.CardDetail_Account + account + msg1 + lg.CardDetail_FillDetail); Console.WriteLine(DateTime.Now + " -" + lg.API_Display + lg.NineYou + lg.CardDetail_Account + account + msg1 + lg.CardDetail_FillDetail); ds = CardDetailInfo.CardDetailInfo_Query(account, cardID, cardPwd, actionType); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); //byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0])); //strut.AddTagKey(TagName.CARD_PDID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); //strut.AddTagKey(TagName.CARD_PDkey, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.CARD_PDCardType, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.CARD_PDFrom, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.CARD_cardnum, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.CARD_cardpass, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.CARD_price, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[6]); strut.AddTagKey(TagName.CARD_PDaction, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); // bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[8])); // strut.AddTagKey(TagName.CARD_PDuserid, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[7])); strut.AddTagKey(TagName.CARD_PDusername, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); // bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[10])); // strut.AddTagKey(TagName.CARD_PDgetuserid, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[8]); strut.AddTagKey(TagName.CARD_PDgetusername, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[9])); strut.AddTagKey(TagName.CARD_PDdate, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.CARD_ADMIN, ServiceKey.CARD_USERCHARGEDETAIL_QUERY_RESP, 10)); } else { return(Message.COMMON_MES_RESP(lg.CardDetail_NoChargeRecord, Msg_Category.CARD_ADMIN, ServiceKey.CARD_USERCHARGEDETAIL_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(lg.CardDetail_NoChargeRecord, Msg_Category.CARD_ADMIN, ServiceKey.CARD_USERCHARGEDETAIL_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 查看玩家身上道具 /// </summary> /// <returns></returns> public Message itemShop_Owner_Query(int index, int pageSize) { string serverIP = null; int userIndexID = 0; DataSet ds = null; try { serverIP = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.SDO_ServerIP).m_bValueBuffer); TLV_Structure tlvStrut = new TLV_Structure(TagName.SDO_UserIndexID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.SDO_UserIndexID).m_bValueBuffer); userIndexID = (int)tlvStrut.toInteger(); Console.WriteLine(DateTime.Now + " - " + lg.API_Display + lg.SDOAPI_SDO + "+>" + lg.API_CommonAPI_ServerIP + CommonInfo.serverIP_Query(serverIP) + lg.SDOAPI_SDOItemLogInfoAPI_Account + userIndexID + lg.SDOAPI_SDOItemShopAPI_PersonalItem + "!"); //请求玩家身上的道具 ds = ItemShopInfo.itemShop_Query(serverIP, userIndexID); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); //道具编号 byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0]); strut.AddTagKey(TagName.SDO_ItemCode, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具名 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.SDO_ItemName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //最小等级 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.SDO_MinLevel, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具位置 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[3]); strut.AddTagKey(TagName.SDO_Postion, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具使用次数 int timelimits = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[4]); if (timelimits == -1) { timelimits = 0; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, timelimits); strut.AddTagKey(TagName.SDO_TimesLimit, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //道具时间限制 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.SDO_DateLimit, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; } return(Message.COMMON_MES_RESP(structList, Msg_Category.SDO_ADMIN, ServiceKey.SDO_ITEMSHOP_BYOWNER_QUERY_RESP, 7)); } else { return(Message.COMMON_MES_RESP(lg.SDOAPI_SDOItemShopAPI_NoItemOnPlayer, Msg_Category.SDO_ADMIN, ServiceKey.SDO_ITEMSHOP_BYOWNER_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (Common.Logic.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(lg.SDOAPI_SDOItemShopAPI_NoItemOnPlayer, Msg_Category.SDO_ADMIN, ServiceKey.SDO_ITEMSHOP_BYOWNER_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }