Beispiel #1
0
 public int UpdateGrowLevelConfig(GrowLevelConfig glc)
 {
     return(this.aidePlatformData.UpdateGrowLevelConfig(glc));
 }
        /// <summary>
        /// 更新等级配置
        /// </summary>
        private void UpdateLevelConfig(HttpContext context)
        {
            //验证权限
            int             moduleID = 408;
            AdminPermission adminPer = new AdminPermission(userExt, moduleID);

            if (!adminPer.GetPermission((long)Permission.Delete))
            {
                ajv.msg = "非法操作,无操作权限";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            int    levelID    = GameRequest.GetFormInt("id", 0);
            string experience = GameRequest.GetFormString("experience");
            string gold       = GameRequest.GetFormString("gold");
            string medal      = GameRequest.GetFormString("medal");
            string remark     = GameRequest.GetFormString("remark");

            //验证ID
            if (levelID == 0)
            {
                ajv.msg = "非法操作,无效的等级标识";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证经验值
            if (!Utils.Validate.IsNumeric(experience))
            {
                ajv.msg = "请输入正确的经验值";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证金币
            if (!Utils.Validate.IsNumeric(gold))
            {
                ajv.msg = "请输入正确的金币";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证元宝
            if (!Utils.Validate.IsNumeric(medal))
            {
                ajv.msg = "请输入正确的元宝";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            //验证备注
            if (remark.Length > 64)
            {
                ajv.msg = "备注的最大长度不能超过64";
                context.Response.Write(ajv.SerializeToJson());
                return;
            }

            GrowLevelConfig glc = new GrowLevelConfig();

            glc.LevelID     = levelID;
            glc.Experience  = Convert.ToInt32(experience);
            glc.RewardGold  = Convert.ToInt32(gold);
            glc.RewardMedal = Convert.ToInt32(medal);
            glc.LevelRemark = remark;

            int result = FacadeManage.aidePlatformFacade.UpdateGrowLevelConfig(glc);

            if (result > 0)
            {
                ajv.msg = "修改成功";
                ajv.SetValidDataValue(true);
            }
            else
            {
                ajv.msg = "修改失败";
            }
            context.Response.Write(ajv.SerializeToJson());
        }