protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck("", Session, Response); if (!IsPostBack) { string acc = Request.QueryString["acc"]; string right = Request.QueryString["right"]; if (string.IsNullOrEmpty(acc)) { return; } m_right.Items.Add(new ListItem("能够创建下级代理", RIGHT.CREATE_AGENCY.ToString())); m_right.Items.Add(new ListItem("能够创建API账号", RIGHT.CREATE_API.ToString())); m_acc.Text = acc; if (RightMap.hasRight(RIGHT.CREATE_AGENCY, right)) { m_right.Items[0].Selected = true; } if (RightMap.hasRight(RIGHT.CREATE_API, right)) { m_right.Items[1].Selected = true; } } }
// 权限分配 protected void rightDispatch(MemberInfoDetail info, GMUser user) { if (!isShowRightOp(info, user)) { rightOp.Visible = false; return; } var allR = RightMap.getDispatchRight(info.m_accType); if (allR == null) { return; } foreach (var ritem in allR) { CheckBox ck = new CheckBox(); rightGroup.Controls.Add(ck); ck.Text = ritem.Value.m_rightName; ck.InputAttributes.Add("value", ritem.Key); if (RightMap.hasRight(ritem.Key, info.m_gmRight)) { ck.Checked = true; } } }
// 判断account是否具有权限right public RightResCode hasRight(string right, HttpSessionState session) { GMUser user = (GMUser)session["user"]; if (session["user"] == null) { return(RightResCode.right_not_login); } if (!string.IsNullOrEmpty(right)) // 权限非空 { if (!user.isAdmin()) { if (!RightMap.hasInherentRight(user.m_accType, right)) { if (!RightMap.hasRight(right, user.m_right)) { return(RightResCode.right_no_right); } } } } return(RightResCode.right_success); }
public string getRightName() { if (m_accType == AccType.ACC_AGENCY) { string str1 = "", str2 = ""; if (RightMap.hasRight(RIGHT.CREATE_AGENCY, m_gmRight)) { str1 = "yes"; } else { str1 = "no"; } if (RightMap.hasRight(RIGHT.CREATE_API, m_gmRight)) { str2 = "yes"; } else { str2 = "no"; } return(string.Format(StrName.s_rightDesc, str1, str2)); } return(""); }
protected void Page_PreRender(object sender, EventArgs e) { GMUser user = (GMUser)Session["user"]; if (user != null) { tdLoginAcc.InnerText = user.m_user; tdAccLevel.InnerText = StrName.s_accountType[user.m_accType]; tdRemainMoney.InnerText = (user.m_accType == AccType.ACC_SUPER_ADMIN || user.m_accType == AccType.ACC_SUPER_ADMIN_SUB) ? "0" : ItemHelp.toStrByComma(ItemHelp.showMoneyValue(user.m_money)); tdAgentRatio.InnerText = (user.m_agentRatio * 100).ToString() + "%"; tdWashRatio.InnerText = (user.m_washRatio * 100).ToString() + "%"; accType.Value = user.m_accType.ToString(); if (!RightMap.hasRight(user.m_accType, RIGHT.DATA_STAT, user.m_right)) { statParam.Visible = false; } if (!user.isAdmin()) { if (!RightMap.hasRight(RIGHT.APPROVE_API, user.m_right)) { // m_liApiApprove.Visible = false; } } if (!user.isAPIAcc()) { m_liApiLogViewer.Visible = false; m_liApiScore.Visible = false; m_liApiLimit.Visible = false; } setOnlineNum(user); } }
protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck("", Session, Response); if (!IsPostBack) { GMUser user = (GMUser)Session["user"]; string isCreateSub = Request.QueryString["isCreateSub"]; if (!string.IsNullOrEmpty(isCreateSub)) // 仅创建子账号,其它页面转到这里 { m_type.Items.Add(new ListItem("子账号", AccType.ACC_AGENCY_SUB.ToString())); } else if (user.m_accType == AccType.ACC_GENERAL_AGENCY) { m_type.Items.Add(new ListItem("下级代理", AccType.ACC_AGENCY.ToString())); m_type.Items.Add(new ListItem("API账号", AccType.ACC_API.ToString())); m_type.Items.Add(new ListItem("子账号", AccType.ACC_AGENCY_SUB.ToString())); } else if (user.m_accType == AccType.ACC_AGENCY) { if (RightMap.hasRight(RIGHT.CREATE_AGENCY, user.m_right)) { m_type.Items.Add(new ListItem("下级代理", AccType.ACC_AGENCY.ToString())); } else { // m_type.Items.Add(new ListItem("###", AccType.ACC_AGENCY.ToString())); } if (RightMap.hasRight(RIGHT.CREATE_API, user.m_right)) { m_type.Items.Add(new ListItem("API账号", AccType.ACC_API.ToString())); } else { // m_type.Items.Add(new ListItem("###", AccType.ACC_API.ToString())); } m_type.Items.Add(new ListItem("子账号", AccType.ACC_AGENCY_SUB.ToString())); } else { Server.Transfer(DefCC.ASPX_EMPTY); } m_right.Items.Add(new ListItem("能够创建下级代理", RIGHT.CREATE_AGENCY.ToString())); m_right.Items.Add(new ListItem("能够创建API账号", RIGHT.CREATE_API.ToString())); // m_prefix.Text = ""; //m_prefix1.Text = user.m_generalAgency; m_agentRatio.Text = (user.m_agentRatio * 100).ToString(); m_washRatio.Text = (user.m_washRatio * 100).ToString(); RangeValidator2.MaximumValue = (user.m_agentRatio * 100).ToString(); RangeValidator1.MaximumValue = (user.m_washRatio * 100).ToString(); } }
OpRes canApprove(GMUser user) { if (RightMap.hasRight(user.m_accType, RIGHT.APPROVE_API, user.m_right)) { return(OpRes.opres_success); } return(OpRes.op_res_failed); }
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); }
public override OpRes doQuery(object param, GMUser user) { m_result.Clear(); if (!RightMap.hasRight(user.m_accType, RIGHT.VIEW_AGENCY, user.m_right)) { return(OpRes.op_res_no_right); } ParamMemberInfo p = (ParamMemberInfo)param; string cmd = ""; OpRes res = m_generator.genSearchSql(p, user, ref cmd); if (res != OpRes.opres_success) { return(res); } 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++) { MemberInfo info = new MemberInfo(); m_result.Add(info); Dictionary <string, object> data = dataList[i]; info.m_createTime = Convert.ToString(data["createTime"]); info.m_acc = Convert.ToString(data["acc"]); info.m_money = Convert.ToInt64(data["money"]); info.m_moneyType = Convert.ToInt32(data["moneyType"]); info.m_accType = Convert.ToInt32(data["accType"]); info.m_owner = Convert.ToString(data["owner"]); info.m_generalAgency = Convert.ToString(data["generalAgency"]); info.m_gmRight = Convert.ToString(data["gmRight"]); info.m_state = Convert.ToInt32(data["state"]); if (!(data["aliasName"] is DBNull)) { info.m_aliasName = Convert.ToString(data["aliasName"]); } // if (user.m_accType == AccType.ACC_API) // { // info.m_devKey = Convert.ToString(data["devSecretKey"]); // } if (user.isAdmin() || user.isGeneralAgency()) { /*if (data.ContainsKey("lastLoginIP")) * { * if (!(data["lastLoginIP"] is DBNull)) * { * info.m_lastLoginIP = Convert.ToString(data["lastLoginIP"]); * } * }*/ } if (!(data["agentRatio"] is DBNull)) { info.m_agentRatio = Convert.ToDouble(data["agentRatio"]); } if (!(data["washRatio"] is DBNull)) { info.m_washRatio = Convert.ToDouble(data["washRatio"]); } info.m_depth = Convert.ToInt32(data["depth"]); } return(OpRes.opres_success); }