// 超级管理员操作 private OpRes doScoreSuperAdmin(ParamScore p, long score, GMUser user) { OpRes res = OpRes.op_res_failed; if (p.isAddScore()) // 加分 { if (p.isToPlayer()) { res = addScorePlayer(p, score, user); } else { res = addScore(p.m_toAcc, score, user); } } else { if (p.isToPlayer()) { res = decScorePlayer(p, score, user); } else { res = decScore(p.m_toAcc, score, user); } } if (res == OpRes.opres_success) { addScoreToOnlineGM(p, score); scoreLog(TableName.GM_SCORE, p, score, user); } return(res); }
private void scoreLog(string tableName, ParamScore p, long score, GMUser user) { long remainMoney = ItemHelp.getRemainMoney(p.m_toAcc, p.isToPlayer(), user); // 操作账号余额 long opSrcRemainMoney = ItemHelp.getRemainMoney(user.m_user, false, user); /*string cmd = string.Format(SqlStrCMD.SQL_CMD_PLAYER_SCORE, * tableName, * DateTime.Now.ToString(ConstDef.DATE_TIME24), * user.m_user, * p.m_toAcc, * p.m_op, * score, * user.m_moneyType, * user.m_depth, * user.m_createCode, * p.isToPlayer() ? AccType.ACC_PLAYER : 0, * remainMoney); * * user.sqlDb.executeOp(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); */ // 生成上下分记录 OrderInfo oinfo = OrderGenerator.genOfflineSuccessOrder(user.m_user, p.m_toAcc, score, p.m_op, p.isToPlayer() ? AccType.ACC_PLAYER : 0, remainMoney, p.m_orderFrom); // 生成上下分记录 string cmd = OrderGenerator.genSqlForLogScore(oinfo, user.m_createCode, opSrcRemainMoney); user.sqlDb.executeOp(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); }
public override OpRes doDyop(object param, GMUser user) { ParamScore p = (ParamScore)param; long score = 0; if (!long.TryParse(p.m_score, out score)) { return(OpRes.op_res_param_not_valid); } if (score < 0) { return(OpRes.op_res_param_not_valid); } if (!RightMap.hasRight(user.m_accType, RIGHT.SCORE, user.m_right)) { return(OpRes.op_res_no_right); } score = ItemHelp.saveMoneyValue(score); OpRes res = OpRes.op_res_failed; try { HttpContext.Current.Application.Lock(); if (user.m_accType == AccType.ACC_SUPER_ADMIN || user.m_accType == AccType.ACC_SUPER_ADMIN_SUB) { res = doScoreSuperAdmin(p, score, user); } else { if (p.isToPlayer()) // 给玩家上分下分 { res = doScorePlayer(p, score, user); } else // 给管理,上分下分 { res = doScore(p, score, user); } } } catch (System.Exception ex) { CLOG.Info("DyOpScore.doDyop, 出现异常:{0}", ex.ToString()); res = OpRes.op_res_happend_exception; } finally { HttpContext.Current.Application.UnLock(); } // 后续处理 对于来自订单的操作,由于订单Id不会变化,采取轮循会有问题 if (res == OpRes.op_res_player_in_game && p.m_orderFrom == OrderGenerator.ORDER_FROM_BG_OP) { QueryOrderState qos = new QueryOrderState(); int state = qos.queryOrderState(p.m_orderId, user.sqlDb.getServer(user.getMySqlServerID()).queryOne, 10, 1000); if (state != PlayerReqOrderState.STATE_PROCESSING) { res = (state == PlayerReqOrderState.STATE_FINISH) ? OpRes.opres_success : OpRes.op_res_failed; } } return(res); }