protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck("", Session, Response); GMUser user = (GMUser)Session["user"]; if (!user.isAPIAcc()) { Server.Transfer(DefCC.ASPX_EMPTY); } m_view = new CLogViewer(LogTable, m_page, m_foot, opType); if (!IsPostBack) { int count = OpLogMgr.getInstance().getOpInfoCount(); opType.Items.Add(new ListItem("全部", "0")); for (int i = 0; i < s_ids.Length; i++) { OpInfo info = OpLogMgr.getInstance().getOpInfo(s_ids[i]); if (info != null) { opType.Items.Add(new ListItem(info.m_opName, info.m_opType.ToString())); } } PageViewLog gen = m_view.getPageViewFoot(); if (gen.parse(Request)) { opType.SelectedIndex = gen.m_opType; m_time.Text = gen.m_time; onSearchLog(null, null); } } }
protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck("viewlog", Session, Response); if (!IsPostBack) { int count = OpLogMgr.getInstance().getOpInfoCount(); opType.Items.Add(new ListItem("全部", "0")); for (int i = 1; i < LogType.LOG_TYPE_MAX; i++) { OpInfo info = OpLogMgr.getInstance().getOpInfo(i); if (info != null) { opType.Items.Add(new ListItem(info.m_opName, info.m_opType.ToString())); } } if (m_gen.parse(Request)) { opType.SelectedIndex = m_gen.m_opType; m_time.Text = m_gen.m_time; onSearchLog(null, null); } } }
protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck("viewlog", Session, Response); if (!IsPostBack) { int count = OpLogMgr.getInstance().getOpInfoCount(); for (int i = -1; i < count; i++) { OpInfo info = OpLogMgr.getInstance().getOpInfo(i); if (info != null) { opType.Items.Add(new ListItem(info.m_opName, info.m_opType.ToString())); } else { opType.Items.Add(new ListItem("全部", i.ToString())); } } GMUser user = (GMUser)Session["user"]; if (user.m_type != "admin") { Button2.Visible = false; } if (m_gen.parse(Request)) { opType.SelectedIndex = m_gen.m_opType; m_time.Text = m_gen.m_time; onSearchLog(null, null); } } }
private void fillTable(Dictionary <string, object> data, bool css) { if (data == null) { return; } s_content[0] = Convert.ToString(data["id"]); s_content[1] = Convert.ToString(data["OpDbIP"]); s_content[2] = Convert.ToString(data["account"]); s_content[3] = Convert.ToString(data["accountIP"]); OpInfo opinfo = OpLogMgr.getInstance().getOpInfo(Convert.ToInt32(data["OpType"])); if (opinfo != null) { s_content[4] = opinfo.m_opName; } else { s_content[4] = "未知"; } s_content[5] = (Convert.ToDateTime(data["OpTime"])).ToLocalTime().ToString(); if (opinfo.m_param != null) { s_content[6] = opinfo.m_param.getDescription(opinfo, Convert.ToString(data["OpParam"])); } else { s_content[6] = "未知"; } if (data.ContainsKey("comment")) { s_content[7] = Convert.ToString(data["comment"]); } else { s_content[7] = ""; } s_content[8] = Tool.getCheckBoxHtml("sel", s_content[0], false); TableRow tr = new TableRow(); if (css) { tr.CssClass = "alt"; } LogTable.Rows.Add(tr); tr.ID = s_content[0]; int col = s_head.Length; for (int i = 0; i < col; i++) { TableCell td = new TableCell(); tr.Cells.Add(td); td.Text = s_content[i]; } }
// 给指定玩家加钱,gold金币, gem钻石 public bool addPlayerMoney(int playerid, int gold, int gem, GMUser account) { if (gold < 0 || gem < 0 || account == null) { LOG.Info("给玩家id [{0}]增加金币时出错,传入的值为负!", playerid); return(false); } bool res = _addPlayerMoney(playerid, gold, gem, account.getDbServerID()); if (res) { Dictionary <string, object> data = null; // DBMgr.getInstance().getTableData("EtPlayer", "Id", playerid, account.getDbServerID(), DbName.DB_FISH_LORD); if (data != null) { if (data.ContainsKey("IsBot")) { bool isbot = Convert.ToBoolean(data["IsBot"]); if (!isbot) { OpLogMgr.getInstance().addLog(LogType.ADD_MONEY, new ParamAddMoney(playerid, gold, gem), account); } } } } account.setOpResult(res ? OpRes.opres_success : OpRes.op_res_failed); return(res); }
// 向机器人批量加钱 public bool addMoneyToBot(int gold, int gem, GMUser account) { if (gold < 0 || gem < 0 || account == null) { LOG.Info("给机器人加钱时出错,传入的值为负!"); return(false); } int serverid = account.getDbServerID(); List <Dictionary <string, object> > datalist = null; // DBMgr.getInstance().getDataListFromTable("EtPlayer", serverid, DbName.DB_FISH_LORD, "IsBot", true); if (datalist != null) { foreach (Dictionary <string, object> data in datalist) { int playerid = Convert.ToInt32(data["Id"]); _addPlayerMoney(playerid, gold, gem, serverid); } } account.setOpResult(OpRes.opres_success); OpLogMgr.getInstance().addLog(LogType.BATCH_ADD_MONEY, new ParamAddMoney(gold, gem), account); return(true); }
private OpRes createAPI(GMUser user, ResultAPIItem item, ParamApiApprove resultParam) { bool res = user.sqlDb.keyStrExists(TableName.GM_ACCOUNT, "acc", item.m_apiAcc, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); if (res) { return(OpRes.op_res_account_has_exists); // 账号重复 } CreateInfo info = new CreateInfo(); res = getCreatorInfo(user, item.m_apiCreator, info); if (!res) { return(OpRes.op_res_failed); } SqlInsertGenerator gen = new SqlInsertGenerator(); gen.addField("acc", item.m_apiAcc, FieldType.TypeString); gen.addField("pwd", item.m_apiPwd, FieldType.TypeString); gen.addField("accType", AccType.ACC_API, FieldType.TypeNumber); gen.addField("createTime", DateTime.Now.ToString(ConstDef.DATE_TIME24), FieldType.TypeString); gen.addField("owner", item.m_apiCreator, FieldType.TypeString); gen.addField("generalAgency", info.m_generalAgency, FieldType.TypeString); gen.addField("postfix", item.m_apiPrefix, FieldType.TypeString); gen.addField("money", 0, FieldType.TypeNumber); gen.addField("moneyType", 0, FieldType.TypeNumber); string key = Guid.NewGuid().ToString().Replace("-", ""); gen.addField("devSecretKey", key, FieldType.TypeString); gen.addField("gmRight", "", FieldType.TypeString); gen.addField("depth", info.m_depth + 1, FieldType.TypeNumber); string ccode = ItemHelp.genCreateCode(info.m_childCount, info.m_createCode); gen.addField("createCode", ccode, FieldType.TypeString); gen.addField("aliasName", item.m_apiAliasName, FieldType.TypeString); ValidatedCodeGenerator vg = new ValidatedCodeGenerator(); vg.CodeSerial = DefCC.CODE_SERIAL; string validatedCode = vg.CreateVerifyCode(4); gen.addField("validatedCode", validatedCode, FieldType.TypeString); gen.addField("agentRatio", item.m_apiAgentRatio, FieldType.TypeNumber); gen.addField("washRatio", item.m_apiWashRatio, FieldType.TypeNumber); res = updateChildNodeNumber(user, info); if (res) { string sqlCmd = gen.getResultSql(TableName.GM_ACCOUNT); int count = user.sqlDb.executeOp(sqlCmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); if (count > 0) { resultParam.m_resultAcc = item.m_apiAcc; resultParam.m_validatedCode = validatedCode; OpLogMgr.getInstance().addLog(LogType.LOG_TYPE_API_APPROVE, new LogApiApprove(item.m_apiAcc, item.m_apiAliasName), user); return(OpRes.opres_success); } } return(OpRes.op_res_db_failed); }
public override OpRes doQuery(object param, GMUser user) { ParamQueryOpLog p = (ParamQueryOpLog)param; string cond = null; OpRes res = genQueryCond(p, user, ref cond); if (res != OpRes.opres_success) { return(res); } m_result.Clear(); string sqlCount = string.Format(SQL_COUNT, TableName.OPLOG, TableName.GM_ACCOUNT, cond); // 查看满足条件的记当个数 user.totalRecord = user.sqlDb.getRecordCount(sqlCount, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); string cmd = string.Format(SQL_QUERY_LOG, TableName.OPLOG, TableName.GM_ACCOUNT, cond, (p.m_curPage - 1) * p.m_countEachPage, p.m_countEachPage); List <Dictionary <string, object> > dataList = user.sqlDb.queryList(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); if (dataList == null) { return(OpRes.op_res_failed); } for (int i = 0; i < dataList.Count; i++) { ResultOpLogItem info = new ResultOpLogItem(); m_result.Add(info); Dictionary <string, object> data = dataList[i]; info.m_id = Convert.ToInt64(data["opId"]); info.m_opAcc = Convert.ToString(data["opAcc"]); info.m_opAccIP = Convert.ToString(data["opAccIP"]); info.m_opDateTime = Convert.ToDateTime(data["opTime"]).ToString(); info.m_comment = Convert.ToString(data["opComment"]); OpInfo opInfo = OpLogMgr.getInstance().getOpInfo(Convert.ToInt32(data["opType"])); if (opInfo != null) { info.m_opName = opInfo.m_opName; info.m_opDesc = opInfo.m_param.getDescription(opInfo, Convert.ToString(data["opParam"])); } else { info.m_opName = info.m_opDesc = ""; } } return(OpRes.opres_success); }
public override OpRes doGrantBenefit(object param, GMUser user) { ParamGrant p = (ParamGrant)param; int count = 0; try { count = Convert.ToInt32(p.m_grantParam); } catch (System.Exception ex) { return(OpRes.op_res_param_not_valid); } //if (count <= 0) // return OpRes.op_res_failed; if (p.m_target == GrantTarget.grant_target_someone) { OpRes res = addReardToPlayerList(p, count, (int)GrantType.gran_type_ticket, user); if (res == OpRes.opres_success) { OpLogMgr.getInstance().addLog(LogType.LOG_TYPE_ADD_BENEFIT_GIFT, new ParamAddBenefitGift(p.m_successPlayer, count, (int)GrantTarget.grant_target_someone, 0), user); } return(res); } int level = 1; if (p.m_level != "") { try { // 转至level level = Convert.ToInt32(p.m_level); if (level <= 0) { level = 1; } } catch (System.Exception ex) { return(OpRes.op_res_failed); } } #if _OLD_BENEFIT_ IMongoQuery imq = getLevelImq(p.m_target == GrantTarget.grant_target_vip, level); List <string> guid_list = new List <string>(); initBenefit(p.m_target == GrantTarget.grant_target_vip, user, imq, getPlatformName(p.m_platIndex)); bool run = nextPlayerGUIDList(user, 1000, guid_list); while (run) { for (int i = 0; i < guid_list.Count; i++) { DBAddBenefit tmp = new DBAddBenefit(); tmp.m_playerGUID = guid_list[i]; tmp.m_grantType = (int)GrantType.gran_type_ticket; tmp.m_count = count; addBenefitToDB(tmp, user); } guid_list.Clear(); run = nextPlayerGUIDList(user, 1000, guid_list); } #else DBAddBenefit tmp = new DBAddBenefit(); tmp.m_grantType = (int)GrantType.gran_type_ticket; tmp.m_count = count; addFullBenefitToDB(tmp, user, p.m_platIndex); #endif OpLogMgr.getInstance().addLog(LogType.LOG_TYPE_ADD_BENEFIT_GIFT, new ParamAddBenefitGift("", count, (int)p.m_target, level, getPlatformName(p.m_platIndex, false)), user); return(OpRes.opres_success); }