public static SystemAuthorizationInfo GetSystemAuthorization(bool iscreate)
        {
            string key = "DataCache-SystemAuthorizationInfo";
            SystemAuthorizationInfo info = HiCache.Get(key) as SystemAuthorizationInfo;

            if ((info == null) || iscreate)
            {
                string str2 = PostData(authorizationUrl, "host=" + Globals.DomainName);
                if (!string.IsNullOrEmpty(str2))
                {
                    TempAuthorizationInfo info2 = JsonConvert.DeserializeObject <TempAuthorizationInfo>(str2);
                    info = new SystemAuthorizationInfo {
                        state            = (SystemAuthorizationState)info2.state,
                        DistributorCount = info2.count,
                        type             = info2.type,
                        IsShowJixuZhiChi = info2.isshowjszc == "1"
                    };
                    HiCache.Insert(key, info, 360, CacheItemPriority.Normal);
                }
            }
            return(info);
        }
Exemplo n.º 2
0
        public static SystemAuthorizationInfo GetSystemAuthorization(bool iscreate)
        {
            string key = "DataCache-SystemAuthorizationInfo";
            SystemAuthorizationInfo systemAuthorizationInfo = HiCache.Get(key) as SystemAuthorizationInfo;

            if (systemAuthorizationInfo == null || iscreate)
            {
                string value = SystemAuthorizationHelper.PostData(SystemAuthorizationHelper.authorizationUrl, "host=" + Globals.DomainName);
                if (!string.IsNullOrEmpty(value))
                {
                    TempAuthorizationInfo tempAuthorizationInfo = JsonConvert.DeserializeObject <TempAuthorizationInfo>(value);
                    systemAuthorizationInfo = new SystemAuthorizationInfo
                    {
                        state            = (SystemAuthorizationState)tempAuthorizationInfo.state,
                        DistributorCount = tempAuthorizationInfo.count,
                        type             = tempAuthorizationInfo.type,
                        IsShowJixuZhiChi = tempAuthorizationInfo.isshowjszc == "1"
                    };
                    HiCache.Insert(key, systemAuthorizationInfo, 360, CacheItemPriority.Normal);
                }
            }
            return(systemAuthorizationInfo);
        }