/// <summary> /// 获取排名信息 /// </summary> /// <param name="managerId"></param> /// <param name="leagueId"></param> /// <returns></returns> public LeagueRankListResponse GetRank(Guid managerId, int leagueId) { try { var response = ResponseHelper.CreateSuccess <LeagueRankListResponse>(); var leagueRecord = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId); if (leagueRecord == null) { SystemlogMgr.Error("获取联赛信息", "经理联赛记录未找到ManagerId:" + managerId); return(ResponseHelper.InvalidParameter <LeagueRankListResponse>()); } if (!leagueRecord.IsStart) { return(ResponseHelper.Create <LeagueRankListResponse>(MessageCode.LeagueNotStart)); } //获取排名 var leagueFightMap = new LeagueFightMapFrame(managerId); int myRank = 0; int myScore = 0; var rankList = leagueFightMap.GetRank(ref myRank, ref myScore); response.Data = new LeagueRank(); response.Data.RankList = rankList; response.Data.MyRank = myRank; response.Data.MyScore = myScore; return(response); } catch (Exception ex) { SystemlogMgr.Error("获取排名信息", ex); return(ResponseHelper.Create <LeagueRankListResponse>(MessageCode.NbParameterError)); } }
/// <summary> /// 获取联赛情况 /// </summary> /// <param name="managerId"></param> /// <param name="leagueId"></param> /// <param name="currectLeague"></param> /// <returns></returns> public GetLeagueInfoResponse GetLeagueInfo(Guid managerId, int leagueId, LeagueManagerrecordEntity currectLeague) { try { if (currectLeague == null) { currectLeague = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId); } if (currectLeague == null) { SystemlogMgr.Error("获取联赛信息", "经理联赛记录未找到ManagerId:" + managerId); return(ResponseHelper.InvalidParameter <GetLeagueInfoResponse>()); } var leagueRecord = LeagueRecordMgr.GetById(currectLeague.LeagueRecordId); //获取胜场 var leagueWincountRecord = LeagueWincountrecordMgr.GetRecord(managerId, currectLeague.LaegueId); var winConfig = CacheFactory.LeagueCache.GetLeagueStar(leagueId); var winList = new List <LeagueWinCountInfo>(); var prizeStatus = leagueWincountRecord.PrizeStep.Split(','); foreach (var item in winConfig) { LeagueWinCountInfo entity = new LeagueWinCountInfo(); entity.PrizeLevel = item.PrizeLevel; if (prizeStatus.Length >= item.PrizeLevel) { entity.PrizeStatus = ConvertHelper.ConvertToInt(prizeStatus[item.PrizeLevel - 1]); } winList.Add(entity); } //获取排名 var leagueFightMap = new LeagueFightMapFrame(managerId); int myRank = 0; int myScore = 0; var rankList = leagueFightMap.GetRank(ref myRank, ref myScore); var response = ResponseHelper.CreateSuccess <GetLeagueInfoResponse>(); response.Data = new LeagueInfoEntity(); if (leagueRecord.Schedule > currectLeague.MaxWheelNumber) { response.Data.IsHaveReturnMain = true; leagueRecord.Schedule = currectLeague.MaxWheelNumber; } response.Data.LeagueInfo = currectLeague; response.Data.MyWinCount = leagueWincountRecord.MaxWinCount; response.Data.LeagueRecord = leagueRecord; response.Data.LeagueWincountRecord = winList; response.Data.MyRank = myRank; response.Data.RankList = rankList; response.Data.IsHaveStartLeague = true; return(response); } catch (Exception ex) { SystemlogMgr.Error("联赛-获取联赛信息", ex); return(ResponseHelper.InvalidParameter <GetLeagueInfoResponse>()); } }