public static TCPProcessCmdResults ProcessQueryUserFirstCharge(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 != 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); } string uid = fields[0]; DBUserInfo info = dbMgr.GetDBUserInfo(uid); if (null == info) { LogManager.WriteLog(LogTypes.Error, string.Format("发起请求的账号不存在,CMD={0}, RoleID={1}", (TCPGameServerCmds)nID, uid), null, true); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); return(TCPProcessCmdResults.RESULT_DATA); } DBUserInfo userInfo = dbMgr.GetDBUserInfo(uid); string ret = CFirstChargeMgr.GetFirstChargeInfo(dbMgr, uid); if (ret != "-2") { tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, ret, nID); } else { tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, "0", 30767); } return(TCPProcessCmdResults.RESULT_DATA); } catch (Exception e) { LogManager.WriteException("ProcessSaveUserFirstCharge:" + e.ToString()); } return(TCPProcessCmdResults.RESULT_DATA); }
public static void SendToRolebindgold(DBManager dbMgr, string uid, int rid, int addMoney, SingleChargeData chargeData) { if (chargeData == null) { LogManager.WriteException(string.Concat(new object[] { "送绑钻失败,配置表信息为空 uid=", uid, " money=", addMoney })); } else { string data = CFirstChargeMgr.GetFirstChargeInfo(dbMgr, uid); string strPlat = (uid.Length >= 4) ? uid.Substring(0, 4) : ""; int nPlatformID = 1; if (strPlat == "APPS") { nPlatformID = 2; } CFirstChargeMgr.ChargeType type = CFirstChargeMgr.ChargeType.Normal; string strYYB = (uid.Length >= 3) ? uid.Substring(0, 3) : ""; if (strYYB == "YYB") { type = CFirstChargeMgr.ChargeType.YingYongBao; } else if (strYYB == "GAT" || strYYB == "430") { type = CFirstChargeMgr.ChargeType.GangAoTai; } string[] datalist = null; if (!string.IsNullOrEmpty(data)) { datalist = data.Split(new char[] { ',' }); } List <int> listAddMoney = CFirstChargeMgr.MuiltchargeGetBindmoney(addMoney, nPlatformID, datalist, type, chargeData); if (listAddMoney != null) { for (int i = 0; i < listAddMoney.Count; i++) { if (!string.IsNullOrEmpty(data)) { data = data + "," + listAddMoney[i]; } else { data = string.Concat(listAddMoney[i]); } } if (!CFirstChargeMgr.UpdateFirstCharge(dbMgr, uid, data, 0)) { LogManager.WriteException(string.Concat(new object[] { "送绑钻失败,保存数据库失败 uid=", uid, " money=", addMoney })); } else { for (int i = 0; i < listAddMoney.Count; i++) { int bindMoney = chargeData.singleData[listAddMoney[i]]; string gmCmdData = string.Format("-updateBindgold {0} {1} {2} {3}", new object[] { uid, rid, bindMoney, data }); ChatMsgManager.AddGMCmdChatMsg(-1, gmCmdData); } } } } }