Exemplo n.º 1
0
        public LadderMatchEntityListResponse GetMatchList(Guid managerId)
        {
            var response = ResponseHelper.CreateSuccess <LadderMatchEntityListResponse>();

            response.Data = new LadderMatchEntityList();
            var list = CrossladderMatchMgr.GetFiveMatch(managerId);

            if (list != null)
            {
                response.Data.Matchs = new List <LadderMatchEntityView>(list.Count);
                foreach (var match in list)
                {
                    string      awayName = "";
                    EnumWinType winType;    //0:负; 1:胜;2:平
                    int         prizeScore;
                    string      score = ""; //比分 2:3
                    if (managerId == match.HomeId && match.HomeIsBot == false)
                    {
                        awayName   = match.AwayName;
                        prizeScore = match.PrizeHomeScore;
                        score      = string.Format("{0}:{1}", match.HomeScore, match.AwayScore);
                        winType    = ShareUtil.CalWinType(match.HomeScore, match.AwayScore);
                    }
                    else
                    {
                        if (match.AwayIsBot)
                        {
                            continue;
                        }
                        awayName   = match.HomeName;
                        prizeScore = match.PrizeAwayScore;
                        score      = string.Format("{0}:{1}", match.AwayScore, match.HomeScore);
                        winType    = ShareUtil.CalWinType(match.AwayScore, match.HomeScore);
                    }
                    response.Data.Matchs.Add(BuildMatchView(match.Idx, awayName, prizeScore, score, winType));
                }
            }
            return(response);
        }