/// <summary>
        /// 验证是否有用户id参数
        /// </summary>
        /// <returns></returns>
        protected virtual bool ValidationLoginUserId()
        {
            var sings = FormsPrincipal <CookUserInfo> .TryParsePrincipal(Request);

            if (null == sings)
            {
                return(false);
            }
            this.mCookUserInfo = sings.UserData;
            if (null != this.mCookUserInfo)
            {
                this.mloginUserId = this.mCookUserInfo.Id;
                var sessionitem = mSysUserSessionService.GetUserId(this.mCookUserInfo.Id);

                if (sessionitem == null || sessionitem.SessionId != mCookUserInfo.Sex)
                {
                    //清除cookie ,禁止登录,
                    FormsPrincipal <CookUserInfo> .SignOut();

                    AppGlobal.RenderResult(ApiCode.ExitLogin);
                    return(false);
                }
            }
            else
            {
                int.TryParse(this.Request.Params["loginUserId"], out mloginUserId);
            }

            return(mloginUserId > 0);
        }
        /// <summary>
        /// 获取登录用户信息
        /// </summary>
        private void InititalLoginUser()
        {
            FormsPrincipal <CookUserInfo> source = FormsPrincipal <CookUserInfo> .TryParsePrincipal(this.Request);

            if (null != source)
            {
                this.LoginUser = source.UserData;
            }
        }
        public virtual bool ValidateLoginUser()
        {
            var cookUser = FormsPrincipal <CookUserInfo> .TryParsePrincipal(Request);

            if (null == cookUser || cookUser.UserData == null)
            {
                return(false);
            }
            this.CookUserInfo = cookUser.UserData;
            return(true);
        }
        /// <summary>
        /// 身份验证
        /// </summary>
        /// <returns></returns>
        protected virtual bool Validation()
        {
            //身份验证
            FormsPrincipal <CookUserInfo> source = FormsPrincipal <CookUserInfo> .TryParsePrincipal(this.Request);

            if (null == source || source.UserData == null)
            {
                AppGlobal.RenderResult(ApiCode.Security);
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 验证用户是否被禁用
        /// </summary>
        private void VerificationUser()
        {
            ValidationLoginUserId();
            var sings = FormsPrincipal <CookUserInfo> .TryParsePrincipal(Request);

            if (null == sings)
            {
                AppGlobal.RenderResult(ApiCode.Fail);
                return;
            }
            var loginuser = sings.UserData;

            if (null == loginuser)
            {
                AppGlobal.RenderResult(ApiCode.Fail);
                return;
            }


            if (loginuser != null)
            {
                //验证是否被禁用

                var item = mSysUserService.Get(loginuser.Id);
                if (null == item)
                {
                    AppGlobal.RenderResult(ApiCode.Fail);
                    return;
                }
                if (item.IsLockCards || item.IsDelete)
                {
                    AppGlobal.RenderResult(ApiCode.Success);
                    Logout();//注销
                }
                else
                {
                    AppGlobal.RenderResult(ApiCode.Fail);
                }
            }
            else
            {
                AppGlobal.RenderResult(ApiCode.Success);
            }
        }
Exemple #6
0
        private void WinTTS()
        {
            var sings = FormsPrincipal <CookUserInfo> .TryParsePrincipal(Request);

            if (null == sings)
            {
                AppGlobal.RenderResult(ApiCode.ExitLogin);
                return;
            }
            var userdata = sings.UserData;

            if (null == userdata)
            {
                AppGlobal.RenderResult(ApiCode.ExitLogin);
                return;
            }

            //必须验证用户登录

            //真是中奖数据
            var result = mBetDetailService.GetRecentlyWin();

            if (null == result)
            {
                result = new List <RecentlyWinDTO>();
            }
            var wins = Ytg.ServerWeb.BootStrapper.SiteHelper.GetWinsMonery();

            if (wins != null)
            {
                int length   = wins.Count;//虚拟数据总条数
                var config   = SiteHelper.GetLotteryIdName();
                var keyArray = config.Keys.ToList();
                for (var i = 0; i < keyArray.Count; i++)
                {
                    var configIdStr = keyArray[i];
                    var opendIssue  = this.mLotteryIssueService.GetTop5OpendIssue(configIdStr);
                    if (opendIssue.Count < 1)
                    {
                        continue;
                    }

                    foreach (var tt in opendIssue)
                    {
                        if (wins.Count > 0)
                        {
                            var fs = wins[0];
                            result.Add(new RecentlyWinDTO()
                            {
                                Code        = fs.UserCode,
                                WinMoney    = fs.UserWinMonery,
                                IssueCode   = tt.IssueCode,
                                LotteryName = config[configIdStr]
                            });
                            wins.RemoveAt(0);
                        }
                    }
                }
            }

            result = result.OrderBy(x => x.Code).ToList();


            AppGlobal.RenderResult <List <RecentlyWinDTO> >(ApiCode.Success, result);
        }