using System; using System.Collections.Generic; using CB.Cache; using CB.Entity; namespace CB.Data { public partial class Caches { /// /// 页面推荐列表 热点推荐列表 /// /// public static IList GetRecommendList() { var cache = CBCache.GetCacheService(); IList list = cache.GetObject(CacheKeys.RecommendList) as IList; if (null == list) { list = RecommendsService.ToList(); cache.AddObject(CacheKeys.RecommendList, list); } return list; } /// /// 获取推荐信息 热点推荐 /// /// /// public static RecommendInfo GetRecommend(int id) { var list = GetRecommendList(); if (null == list || 0 >= list.Count) return null; RecommendInfo entity = null; foreach (var item in list) { if (id == item.Id) { entity = item; break; } } return entity; } /// /// 获取推荐内容 热点内容 /// /// /// public static string GetRecommendContent(int id) { var entity = GetRecommend(id); return null == entity ? "" : entity.Content; } } }