using System; using System.Collections.Generic; using System.Linq; using CB.Cache; using CB.Entity; namespace CB.Data { //TrendChart public partial class Caches { /// /// 获取走势图表列表 /// /// public static IList GetTrendChartList() { var cache = CBCache.GetCacheService(); IList list = cache.GetObject(CacheKeys.TrendChartList) as IList; if (null == list) { list = TrendChartService.ToList(); cache.AddObject(CacheKeys.TrendChartList, list); } return list; } /// /// 根据彩种cid获取走势图表 /// /// 彩种ID /// 方向(横屏/竖屏) 0:横屏(普通电脑);1:竖屏(电视) /// public static IList GetTrendChartList(int cid, int direction) { var list = GetTrendChartList(); if (null == list || 0 >= list.Count) return null; IList r = new List(); foreach (var item in list) { if (cid == item.Cid && 0 <= item.Status && direction == item.Direction) r.Add(item); } return r; } /// /// 根据彩种cid和目录tid获取走势图表 /// /// 彩种id /// 2001:走势;2002:图表;2003:遗漏;2004:图表 /// 方向(横屏/竖屏) 0:横屏(普通电脑);1:竖屏(电视) /// public static IList GetTrendChartList(int cid, int tid, int direction) { var list = GetTrendChartList(); if (null == list || 0 >= list.Count) return null; IList r = new List(); foreach (var item in list) { if (cid == item.Cid && tid == item.Tid && 0 <= item.Status && direction == item.Direction) r.Add(item); } return r; } /// /// 获取走势图表详细 /// /// /// public static TrendChartInfo GetTrendChartInfo(int chartId) { var list = GetTrendChartList(); if (null == list || 0 >= list.Count) return null; TrendChartInfo entity = null; foreach (var item in list) { var ss = list.ToList().Where(a => a.Id == chartId).ToList(); if (chartId == item.Id && 0 <= item.Status) { entity = item; break; } } return entity; } /// /// 走势图表智能推荐关联列表 /// /// /// /// public static IList GetTrendSmartList(int chartId, int topSize) { var key = string.Format("{0}-{1}-{2}", CacheKeys.TrendSmartList, chartId.ToString(), topSize.ToString()); var cache = CBCache.GetCacheService(); IList list = cache.GetObject(key) as IList; if (null == list) { list = TrendChartService.GetTrendSmartList(chartId, topSize); cache.AddObject(key, list, 1800); } return list; } } }