/// <summary> /// 初始化平台索引 /// </summary> private Dictionary <RecommandKey, List <LiveRecommandNode> > InitIndex(List <int> modes) { var dic = new Dictionary <RecommandKey, List <LiveRecommandNode> >(); foreach (var f in PlatformUtils.FormatLivePlatform()) { foreach (var mode in modes) { dic.Add(new RecommandKey(mode, f.PlatformName, f.Licence), new List <LiveRecommandNode>()); } } return(dic); }
/// <summary> /// 自刷新行为 /// </summary> public override void RefreshCache() { string hql = "from LiveRecommandInfo l order by l.Rank"; var recommands = LiveRecommandInfo.Execute(new HqlReadQuery <LiveRecommandInfo>(hql)) as IList <LiveRecommandInfo>; var modes = recommands.Select(r => r.Mode).Distinct().ToPerfectList(); var dic = InitIndex(modes); foreach (var plat in PlatformUtils.FormatLivePlatform()) { var query = from r in recommands join recrel in ChannelLiveRecomRelCache.Instance.Items on r.ID equals recrel.LiveRecommandID into recrels let x = FormatRecommands(dic, r, plat, recrels) select x; query.Count(); } _cache = dic; }
public LiveVideoContanier() { _plats = PlatformUtils.FormatLivePlatform(); VideoNodeKeyArray.Instance.Init(); var dic = new Dictionary <VideoNodeKey, List <LiveVideoNode> >(); foreach (var f in _plats) { dic.Add(VideoNodeKeyArray.Instance.FindKey(f.PlatformName, 0, f.Licence), new List <LiveVideoNode>()); foreach (var type in LiveTypeCache.Instance.Items) { dic.Add(new VideoNodeKey(f.PlatformName, type.ID, f.Licence), new List <LiveVideoNode>()); } } dic.Add(VideoNodeKeyArray.Instance.FindKey(AuthNode.NoPlatFormName, 0, AuthNode.NoPlatFormLicence), new List <LiveVideoNode>()); _dic = dic; }