Esempio n. 1
0
        /// <summary>
        /// 获取会员状态
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public UserStateInfos GetUserStateByToken(string token)
        {
            UserStateInfos result = null;

            try
            {
                string            apiName    = "user";
                string            resultStr  = HttpHelper.HttpUrlGet(apiName, "GET", token);
                UserStateResponse resultInfo = JsonConvert.DeserializeObject <UserStateResponse>(resultStr);
                if (resultInfo != null)
                {
                    result            = new UserStateInfos();
                    result.PointCount = resultInfo.points;
                    result.PicCount   = resultInfo.count;
                    result.WordCount  = resultInfo.countWord;
                    //////result.Active = resultInfo.vip;
                    //////result.ActiveName = result.Active ? "已购买" : "未购买";
                    //////if (resultInfo.roles != null && resultInfo.roles.Count > 0)
                    //////{
                    //////    foreach (var info in resultInfo.roles)
                    //////    {
                    //////        if (info.expiryTime != null)
                    //////        {
                    //////            if (result.ExpiredDate == null)
                    //////            {
                    //////                result.ExpiredDate = info.expiryTime;
                    //////            }
                    //////            else
                    //////            {
                    //////                if (DateTime.Compare(info.expiryTime, result.ExpiredDate) > 0)
                    //////                {
                    //////                    result.ExpiredDate = info.expiryTime;
                    //////                }
                    //////            }
                    //////        }
                    //////    }
                    //////}
                    //////if (result.ExpiredDate != null)
                    //////{
                    //////    result.ExpiredDateStr = result.ExpiredDate.ToString("yyyy-MM-dd");
                    //////}
                }
            }
            catch (Exception ex)
            {
                WPFClientCheckWordUtil.Log.TextLog.SaveError(ex.Message);
                result = null;
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取会员状态
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public UserStateInfos GetUserStateByToken(string token)
        {
            UserStateInfos result = null;

            try
            {
                string            apiName    = "user";
                string            resultStr  = HttpHelper.HttpUrlGet(apiName, "GET", token);
                UserStateResponse resultInfo = JsonConvert.DeserializeObject <UserStateResponse>(resultStr);
                if (resultInfo != null)
                {
                    result            = new UserStateInfos();
                    result.PointCount = resultInfo.points;
                    result.PicCount   = resultInfo.count;
                    result.WordCount  = resultInfo.countWord;
                }
            }
            catch (Exception ex)
            {
                WPFClientCheckWordUtil.Log.TextLog.SaveError(ex.Message);
                result = null;
            }
            return(result);
        }