コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="playType">玩家奖金类型 1700/1800</param>
        /// <param name="userBackNum"></param>
        /// <param name="radioCode"></param>
        /// <returns></returns>
        private double GetUserBackNum(UserPlayType playType, double userBackNum, int radioCode)
        {
            var radios = Ytg.Service.Lott.BaseDataCatch.GetPalyTypeRadio(this.mPlayTypeRadioService);

            if (null == radios)
            {
                return(-1);
            }
            var fs = radios.Where(c => c.RadioCode == radioCode).FirstOrDefault();

            if (null == fs)
            {
                return(-1);
            }
            return(playType == UserPlayType.P1800 ? fs.MaxRebate - userBackNum : fs.MaxRebate1700 - userBackNum);
        }
コード例 #2
0
        /// <summary>
        /// 新增用户
        /// </summary>
        private void AddUser()
        {
            int userType;

            if (!int.TryParse(Request.Params["userType"], out userType))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            int    parentId = this.LoginUserId;
            string code     = Request.Params["code"];

            if (string.IsNullOrEmpty(code))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            //验证用户是否存在
            var exituser = this.mSysUserService.Get(code);

            if (exituser != null)
            {
                AppGlobal.RenderResult(ApiCode.NotScope);
                return;
            }
            string password = Request.Params["password"];

            if (string.IsNullOrEmpty(password))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            string nickName = Request.Params["nickName"];
            double remb;

            if (!double.TryParse(Request.Params["rmb"], out remb))
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }
            if (remb < 0 || remb > 8)
            {
                AppGlobal.RenderResult(ApiCode.ParamEmpty);
                return;
            }

            var oldremb = remb;

            remb = Math.Round(remb, 1) + LoginUser.Rebate;
            UserPlayType playType = LoginUser.PlayType;

            if (LoginUser.UserType == UserType.BasicProy)
            {
                //总代,允许选择下级玩法
                int outPlayType = 0;
                if (int.TryParse(Request.Params["playType"], out outPlayType))
                {
                    playType = outPlayType == 0 ? UserPlayType.P1800 : UserPlayType.P1700;
                    //总代理,1700模式
                    if (playType == UserPlayType.P1700)
                    {
                        remb = Math.Round(oldremb, 1) + Convert.ToDouble(Utils.ParseShowRebateName1700(Math.Round(LoginUser.Rebate, 1).ToString()));
                    }
                }
            }
            if (LoginUser.UserType == UserType.Main)
            {
                MainAddUser(remb, code, nickName, password);
                return;
            }
            var      minRemo     = Convert.ToDouble(YtgConfig.GetItem("NotQuotaNum") ?? "5.9");
            SysQuota parentQuota = null;

            if ((Ytg.Comm.Utils.MaxRemo - remb) > minRemo)
            {
                //验证父用户是否有指定阶段配额的额度,并且剩余额度大于1
                parentQuota = this.mSysQuotaService.GetUserQuota(parentId, (Ytg.Comm.Utils.MaxRemo - remb));
                if (parentQuota == null || parentQuota.MaxNum < 1)
                {
                    AppGlobal.RenderResult(ApiCode.ValidationFails);
                    return;
                }
            }

            SysUser user = new SysUser()
            {
                Rebate     = Math.Round(remb, 1),
                Code       = code,
                NikeName   = nickName,
                Password   = password,
                UserType   = userType == 0 ? UserType.General : UserType.Proxy,
                ParentId   = parentId,
                ProxyLevel = this.mSysUserService.Get(parentId).ProxyLevel + 1,
                PlayType   = playType,
                Head       = LoginUser.Head
            };

            this.mSysUserService.Create(user);
            this.mSysUserService.Save();
            //用户余额插入数据
            UserComm.InintNewUserBalance(user, this.mSysSettingService, this.mSysUserBalanceService, this.mSysUserBalanceDetailService, this.mSysUserService);//初始化新用户金额
            //设置用户配额
            this.mSysQuotaService.InintUserQuota(user.Id, parentId, Math.Round(Ytg.Comm.Utils.MaxRemo - remb, 1));
            AppGlobal.RenderResult(ApiCode.Success);
        }