public static TCPProcessCmdResults ProcessDBUpdateUserLimitGoodsUsedNumCmd(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 != 5) { 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 goodsID = Convert.ToInt32(fields[1]); int dayID = Convert.ToInt32(fields[2]); int usedNum = Convert.ToInt32(fields[3]); string stage = fields[4]; DBRoleInfo dbRoleInfo = dbMgr.GetDBRoleInfo(ref roleID); if (null == dbRoleInfo) { LogManager.WriteLog(LogTypes.Error, string.Format("发起请求的角色不存在,CMD={0}, RoleID={1}", (TCPGameServerCmds)nID, roleID), null, true); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); } int ret = DBWriter.AddUserLimitGoodsBuyItem(dbMgr, dbRoleInfo.UserID, goodsID, dayID, usedNum, stage); string strcmd; if (ret < 0) { strcmd = string.Format("{0}:{1}", roleID, -1); LogManager.WriteLog(LogTypes.Error, string.Format("添加限购物品的历史记录失败,CMD={0}, RoleID={1}", (TCPGameServerCmds)nID, roleID), null, true); } else { strcmd = string.Format("{0}:{1}", roleID, 0); } 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); }