/// <summary> /// 获取单页网站配置 /// </summary> /// <param name="domain"></param> /// <returns></returns> public static async Task <SiteConfig> GetSiteConfigAsync(string domain) { string key = $"siteconfig:{domain}"; if (!CacheProvider.TryGet <SiteConfig>(key, out SiteConfig config)) { config = await HandleRequestAsync <SiteConfig>(HttpMethod.Get, "api/partnersite/front/siteconfig", new { domain }); if (config != null) { CacheProvider.Set(key, config, TimeSpan.FromMinutes(5)); } } return(config); }
/// <summary> /// 获取资讯类型列表 /// </summary> /// <returns></returns> public static async Task <IEnumerable <NewsType> > GetNewsTypeListAsync() { string path = "api/frontsite/newstypes"; string key = GetCacheKey(path); if (!CacheProvider.TryGet(key, out IEnumerable <NewsType> list)) { list = await HandleRequestAsync <IEnumerable <NewsType> >(HttpMethod.Get, path); if (list.Any()) { CacheProvider.Set(key, list, TimeSpan.FromMinutes(5)); } } return(list); }
/// <summary> /// 获取首页精选全景作品列表 /// </summary> /// <param name="count"></param> /// <returns></returns> public static async Task <IEnumerable <Pano> > GetIndexListAsync(int count) { string path = "api/frontsite/indexpanos"; string key = GetCacheKey(path); if (!CacheProvider.TryGet(key, out IEnumerable <Pano> list)) { list = await HandleRequestAsync <IEnumerable <Pano> >(HttpMethod.Get, path, new { count }); if (list.Any()) { CacheProvider.Set(key, list, TimeSpan.FromMinutes(5)); } } return(list); }