예제 #1
0
        /// <summary>
        /// 获取用户登录信息
        /// </summary>
        /// <param name="loginInfo"></param>
        public LoginInfo GetLoginInfo(LoginInfo loginInfo)
        {
            try
            {
                var cookie   = CookieHelper.GetCookie(loginInfo.Key);
                var userInfo = (cookie != null && String.IsNullOrEmpty(cookie.Value) == false) ? cookie.Value : null;
                if (string.IsNullOrEmpty(userInfo))
                {
                    return(null);
                }
                loginInfo = JsonHelper.JsonToObject <LoginInfo>(CookieHelper.DecryptCookies(userInfo));
                return(loginInfo);
            }
            catch (Exception ex)
            {
                return(new LoginInfo()
                {
                    UserId = "", UserName = string.Empty, NickName = string.Empty
                });

                throw ex;
            }
        }