public void fillResultList(List <RechargeItem> result, List <Dictionary <string, object> > data, GMUser user) { string[] fieldChannel = { "ChannelID" }; for (int i = 0; i < data.Count; i++) { RechargeItem tmp = new RechargeItem(); result.Add(tmp); tmp.m_time = Convert.ToDateTime(data[i]["PayTime"]).ToLocalTime().ToString(); tmp.m_account = Convert.ToString(data[i]["Account"]); tmp.m_orderId = Convert.ToString(data[i]["OrderID"]); tmp.m_payCode = Convert.ToString(data[i]["PayCode"]); tmp.m_process = Convert.ToBoolean(data[i]["Process"]); if (data[i].ContainsKey("RMB")) { tmp.m_totalPrice = Convert.ToInt32(data[i]["RMB"]); } if (data[i].ContainsKey("PlayerId")) { tmp.m_playerId = Convert.ToInt32(data[i]["PlayerId"]); Dictionary <string, object> pd = QueryBase.getPlayerProperty(tmp.m_playerId, user, fieldChannel); if (pd != null) { if (pd.ContainsKey("ChannelID")) { tmp.m_channelId = Convert.ToString(pd["ChannelID"]).PadLeft(6, '0'); } } } /* if (data[i].ContainsKey("ServerId")) * { * int id = Convert.ToInt32(data[i]["ServerId"]); * tmp.m_serverInfo = ResMgr.getInstance().getDbInfoById(id); * }*/ fillResult(tmp, data[i]); } }
void addResult(BsonDocument d, GMUser user, ParamQuery param) { try { StatPlayerDragonBallItem tmp = new StatPlayerDragonBallItem(); m_result.Add(tmp); tmp.m_playerId = Convert.ToInt32(d["_id"]); BsonValue resValue = d["value"]; tmp.m_dbgain = resValue["dbgain"].ToInt64(); tmp.m_dbsend = resValue["dbsend"].ToInt64(); tmp.m_dbaccept = resValue["dbaccept"].ToInt64(); tmp.m_dbexchange = resValue["dbexchange"].ToInt64(); getSEValue(param, user, DB_SE, tmp.m_playerId, ref tmp.m_dbStart, ref tmp.m_dbRemain); tmp.m_goldByRecharge = resValue["goldByRecharge"].ToInt64(); tmp.m_goldByOther = resValue["goldByOther"].ToInt64(); tmp.m_goldConsume = resValue["goldConsume"].ToInt64(); getSEValue(param, user, GOLD_SE, tmp.m_playerId, ref tmp.m_goldStart, ref tmp.m_goldRemain); tmp.m_gemByRecharge = resValue["gemByRecharge"].ToInt64(); tmp.m_gemByOther = resValue["gemByOther"].ToInt64(); tmp.m_gemConsume = resValue["gemConsume"].ToInt64(); getSEValue(param, user, GEM_SE, tmp.m_playerId, ref tmp.m_gemStart, ref tmp.m_gemRemain); tmp.m_todayRecharge = resValue["totalRecharge"].ToInt32(); Dictionary <string, object> ret = QueryBase.getPlayerProperty(tmp.m_playerId, user, PLAYER_FIELDS); if (ret != null) { tmp.m_rechargeFromReg = Convert.ToInt32(ret["recharged"]); tmp.m_regTime = Convert.ToDateTime(ret["create_time"]).ToLocalTime(); } } catch (System.Exception ex) { } }
void addResult(BsonDocument d, GMUser user) { try { RechargePlayerItem tmp = new RechargePlayerItem(); m_result.Add(tmp); tmp.m_playerId = Convert.ToInt32(d["_id"]); BsonValue resValue = d["value"]; tmp.m_rechargeCount = resValue["rechargeCount"].ToInt32(); tmp.m_rechargeMoney = resValue["rechargeMoney"].ToInt32(); tmp.m_loginCount = resValue["loginCount"].ToInt32(); var arr = resValue["enterGame"].AsBsonArray; for (int i = 0; i < arr.Count; i++) { tmp.addEnterCount(i + 1, arr[i].ToInt32()); } Dictionary <string, object> pd = QueryBase.getPlayerProperty(tmp.m_playerId, user, s_fields); if (pd != null) { tmp.m_mostGold = Convert.ToInt32(pd["maxGold"]); tmp.m_remainGold = Convert.ToInt32(pd["gold"]); tmp.m_regTime = Convert.ToDateTime(pd["create_time"]).ToLocalTime(); tmp.m_lastLoginTime = Convert.ToDateTime(pd["logout_time"]).ToLocalTime(); if (pd.ContainsKey("ChannelID")) { tmp.m_channelId = Convert.ToString(pd["ChannelID"]).PadLeft(6, '0'); } } } catch (System.Exception ex) { } }
public override OpRes makeQuery(object param, GMUser user, QueryCondition queryCond) { ParamQueryRecharge p = (ParamQueryRecharge)param; int condCount = 0; PlatformInfo pinfo = null; if (!string.IsNullOrEmpty(p.m_param)) { switch (p.m_way) { case QueryWay.by_way0: // 通过玩家id查询 { int val = -1; if (!int.TryParse(p.m_param, out val)) { return(OpRes.op_res_param_not_valid); } Dictionary <string, object> ret = QueryBase.getPlayerProperty(val, user, s_field); if (ret == null) { return(OpRes.op_res_not_found_data); } if (!ret.ContainsKey("platform")) { return(OpRes.op_res_failed); } // 取玩家ID所在平台 string platName = Convert.ToString(ret["platform"]); queryCond.addQueryCond("PlayerId", val); pinfo = ResMgr.getInstance().getPlatformInfoByName(platName); // 获取服务器ID /*DbServerInfo dbInfo = ResMgr.getInstance().getDbInfo(user.m_dbIP); * if (dbInfo != null) * { * queryCond.addQueryCond("ServerId", dbInfo.m_serverId); * }*/ } break; case QueryWay.by_way1: // 通过账号查询 { Dictionary <string, object> ret = QueryBase.getPlayerPropertyByAcc(p.m_param, user, s_field); if (ret == null) { return(OpRes.op_res_not_found_data); } if (!ret.ContainsKey("platform")) { return(OpRes.op_res_failed); } // 取玩家账号所在平台,然后从相应的平台去查 string platName = Convert.ToString(ret["platform"]); queryCond.addQueryCond("Account", p.m_param); pinfo = ResMgr.getInstance().getPlatformInfoByName(platName); // 获取服务器ID /* DbServerInfo dbInfo = ResMgr.getInstance().getDbInfo(user.m_dbIP); * if (dbInfo != null) * { * queryCond.addQueryCond("ServerId", dbInfo.m_serverId); * }*/ } break; case QueryWay.by_way2: // 通过订单号查询 { pinfo = ResMgr.getInstance().getPlatformInfo(p.m_platIndex); queryCond.addQueryCond("OrderID", p.m_param); } break; default: { return(OpRes.op_res_failed); } } condCount++; } else { pinfo = ResMgr.getInstance().getPlatformInfo(p.m_platIndex); // 获取服务器ID /*DbServerInfo dbInfo = ResMgr.getInstance().getDbInfo(user.m_dbIP); * if (dbInfo != null) * { * queryCond.addQueryCond("ServerId", dbInfo.m_serverId); * }*/ } if (pinfo == null) { return(OpRes.op_res_need_sel_platform); } if (!m_items.ContainsKey(pinfo.m_engName)) { return(OpRes.op_res_not_found_data); } m_rbase = m_items[pinfo.m_engName]; m_platInfo.m_tableName = pinfo.m_tableName; m_platInfo.m_platName = pinfo.m_engName; if (queryCond.isExport()) { queryCond.addCond("table", m_platInfo.m_tableName); queryCond.addCond("plat", m_platInfo.m_platName); } if (p.m_time != "") { DateTime mint = DateTime.Now, maxt = DateTime.Now; bool res = Tool.splitTimeStr(p.m_time, ref mint, ref maxt); if (!res) { return(OpRes.op_res_time_format_error); } condCount++; if (queryCond.isExport()) { queryCond.addCond("time", p.m_time); } else { IMongoQuery imq1 = Query.LT("PayTime", BsonValue.Create(maxt)); IMongoQuery imq2 = Query.GTE("PayTime", BsonValue.Create(mint)); queryCond.addImq(Query.And(imq1, imq2)); } } if (p.m_result > 0) { queryCond.addQueryCond("Process", p.m_result == 1 ? true : false); } if (!string.IsNullOrEmpty(p.m_range)) { if (!Tool.isTwoNumValid(p.m_range)) { return(OpRes.op_res_param_not_valid); } if (queryCond.isExport()) { queryCond.addCond("range", p.m_range); } else { List <int> range = new List <int>(); Tool.parseNumList(p.m_range, range); IMongoQuery timq1 = Query.LTE("RMB", BsonValue.Create(range[1])); IMongoQuery timq2 = Query.GTE("RMB", BsonValue.Create(range[0])); IMongoQuery tmpImq = Query.And(timq1, timq2); queryCond.addImq(tmpImq); } } if (condCount == 0) { return(OpRes.op_res_need_at_least_one_cond); } return(OpRes.opres_success); }