public override void InitCacheManager() { var organizerEntityManager = new OrganizerEntityManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(OrganizerEntityManager).Name, organizerEntityManager); DicCacheManagers.Add(typeof(OrganizerEntityManager).Name, (ICacheManager)organizerEntityManager); var leagueEntityManager = new LeagueEntityManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(LeagueEntityManager).Name, leagueEntityManager); DicCacheManagers.Add(typeof(LeagueEntityManager).Name, (ICacheManager)leagueEntityManager); var matchEntityManager = new MatchEntityManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(MatchEntityManager).Name, matchEntityManager); DicCacheManagers.Add(typeof(MatchEntityManager).Name, (ICacheManager)matchEntityManager); var playerEntityManager = new PlayerEntityManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(PlayerEntityManager).Name, playerEntityManager); DicCacheManagers.Add(typeof(PlayerEntityManager).Name, (ICacheManager)playerEntityManager); var playerPenaltiesManager = new PlayerPenaltiesManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(PlayerPenaltiesManager).Name, playerPenaltiesManager); DicCacheManagers.Add(typeof(PlayerPenaltiesManager).Name, (ICacheManager)playerPenaltiesManager); var PlayerStatisticsRecordManager = new PlayerStatisticsRecordManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(PlayerStatisticsRecordManager).Name, PlayerStatisticsRecordManager); DicCacheManagers.Add(typeof(PlayerStatisticsRecordManager).Name, (ICacheManager)PlayerStatisticsRecordManager); var playerTimeRecordManager = new PlayerTimeRecordManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(PlayerTimeRecordManager).Name, playerTimeRecordManager); DicCacheManagers.Add(typeof(PlayerTimeRecordManager).Name, (ICacheManager)playerTimeRecordManager); var seasonEntityManager = new SeasonEntityManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(SeasonEntityManager).Name, seasonEntityManager); DicCacheManagers.Add(typeof(SeasonEntityManager).Name, (ICacheManager)seasonEntityManager); var seasonTypeInfoManager = new SeasonTypeInfoManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(SeasonTypeInfoManager).Name, seasonTypeInfoManager); DicCacheManagers.Add(typeof(SeasonTypeInfoManager).Name, (ICacheManager)seasonTypeInfoManager); var seasonTableInfoManager = new SeasonTableInfoManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(SeasonTableInfoManager).Name, seasonTableInfoManager); DicCacheManagers.Add(typeof(SeasonTableInfoManager).Name, (ICacheManager)seasonTableInfoManager); var seasonTeamsManager = new SeasonTeamsManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(SeasonTeamsManager).Name, seasonTeamsManager); DicCacheManagers.Add(typeof(SeasonTeamsManager).Name, (ICacheManager)seasonTeamsManager); var teamEntityManager = new TeamEntityManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(TeamEntityManager).Name, teamEntityManager); DicCacheManagers.Add(typeof(TeamEntityManager).Name, (ICacheManager)teamEntityManager); var teamPlayersManager = new TeamPlayersManager(); IocUnity.RegisterInstance <ICacheManager>(typeof(TeamPlayersManager).Name, teamPlayersManager); DicCacheManagers.Add(typeof(TeamPlayersManager).Name, (ICacheManager)teamPlayersManager); }
public void Process(ITakerReptile.Dto.BaseData data) { BRData bd = data as BRData; SeasonParam param = bd.Param as SeasonParam; CheckSetHistoryParam(param); string txt; if (!HtmlDecode(bd.Html, out txt)) { return; } // 首先添加联赛层级的比赛任务 MatchParam mp = param.CopyCreateParam <MatchParam>(); LeagueManager.AddOrUpdateParam(mp); if (param.CurrentUrlKey == "tableIds") { ProcessTableIdsTxt(param, txt); return; } else if (param.CurrentUrlKey == "teamIds") { ProcessTeamIdsTxt(param, txt); return; } var xml = new XmlHelper(txt); // 获取赛季名称 var title = xml.GetAttributeValue("//page", "title"); var seasonName = title.Split('>').Last(); SeasonEntity currentSeasonEntity = new SeasonEntity(); currentSeasonEntity.SportId = param.SportId; currentSeasonEntity.SeasonId = param.SeasonId; currentSeasonEntity.SeasonName = seasonName; // 获取积分数据块 var cdataFlag = "//c"; var cdata = xml.GetValues(cdataFlag); if (cdata.Count == 0) { // 杯赛没有积分数据的,添加获取所有队伍Id的任务 param = param.CopyCreateParam <SeasonParam>(); param.SetCurrentUrlKey("teamIds"); LeagueManager.AddOrUpdateParam(param); return; } var teamRankData = ""; if (cdata.Count > 5) { teamRankData = cdata[4]; } if (string.IsNullOrEmpty(teamRankData)) { return; } var currentRound = RegexGetStr(cdata[0], "sb-current\"><div class=\"label\">", "<"); currentSeasonEntity.CurrentRound = currentRound; SeasonEntity se = SeasonEntityManager.AddOrGetCacheEntity <SeasonEntity>(param.SeasonId); se.CompareSetSeasonInfo(currentSeasonEntity); // 解析积分数据,并添加队伍任务,添加队伍积分数据,其他数据可由已经结束的比赛结果计算 List <string> teamIdList = new List <string>(); List <SeasonTeamRank> trList = new List <SeasonTeamRank>(); var root = GetHtmlRoot(teamRankData); var tables = root.SelectNodes("//table[@class='normaltable']/tbody"); if (tables.Count == 0) { return; } if (tables.Count > 1) { // 多个积分榜数据,有分组别的,添加获取所有组别Id的任务 param = param.CopyCreateParam <SeasonParam>(); param.SetCurrentUrlKey("tableIds"); LeagueManager.AddOrUpdateParam(param); // 同时添加获取全部队伍Id的任务 param = param.CopyCreateParam <SeasonParam>(); param.SetCurrentUrlKey("teamIds"); LeagueManager.AddOrUpdateParam(param); return; } foreach (var node in tables[0].ChildNodes) { var teamId = RegexGetStr(node.ChildNodes[2].InnerHtml, "teamid','", "',"); teamIdList.Add(teamId); var trDataArr = node.ChildNodes.Select(o => o.InnerText).ToArray(); SeasonTeamRank tr = new SeasonTeamRank() { SeasonId = param.SeasonId, TeamId = teamId, TeamPoints = trDataArr[11], Description = trDataArr[12] }; trList.Add(tr); } SeasonTeams st = SeasonTeamsManager.AddOrGetCacheEntity <SeasonTeams>(param.SeasonId); st.CompareSetTeamRank(trList); // 要分配的队伍任务 var teamTaskDic = se.CompareSetTeamIdList(teamIdList); TeamAssignTask(param, teamTaskDic); }