Пример #1
0
        /// <summary>
        /// 获取项目装修风格标签列表
        /// </summary>
        /// <returns></returns>
        public static async Task <IEnumerable <ProjectDecorationStyle> > GetDecorationStyleListAsync()
        {
            string path = "api/zaigou/decorationstyles";
            string key  = GetCacheKey(path);

            if (!CacheProvider.TryGet(key, out IEnumerable <ProjectDecorationStyle> list))
            {
                list = await HandleRequestAsync <IEnumerable <ProjectDecorationStyle> >(HttpMethod.Get, path);

                if (list.Any())
                {
                    CacheProvider.Set(key, list, TimeSpan.FromMinutes(5));
                }
            }

            return(list);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <summary>
        /// 获取首页Banner
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="type">0、首页Banner;1、首页广告位</param>
        /// <returns></returns>
        public static async Task <PagedList <Banners> > GetBannerListAsync(int page, int pageSize, int type = -1)
        {
            string path = $"api/zaigou/banners/{page}/{pageSize}";
            string key  = GetCacheKey(path + "/" + type);

            if (!CacheProvider.TryGet(key, out PagedList <Banners> list))
            {
                list = await HandleRequestAsync <PagedList <Banners> >(HttpMethod.Get, path, new { type_id = type });

                if (list.count > 0)
                {
                    CacheProvider.Set(key, list, TimeSpan.FromMinutes(5));
                }
            }

            return(list);
        }
Пример #4
0
        /// <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);
        }