Beispiel #1
0
        public MessageCode ResetLeague(Guid managerId, int leagueId, int point)
        {
            DateTime date          = DateTime.Now;
            var      managerRecord = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId);

            managerRecord.LeagueRecordId = new Guid();//00000000-0000-0000-0000-000000000000
            //managerRecord.LastPrizeLeagueRecordId = new Guid();
            managerRecord.IsPass         = false;
            managerRecord.IsStart        = false;
            managerRecord.MatchNumber    = 0;
            managerRecord.Score          = 0;
            managerRecord.WinNumber      = 0;
            managerRecord.FlatNumber     = 0;
            managerRecord.LoseNumber     = 0;
            managerRecord.GoalsNumber    = 0;
            managerRecord.FumbleNumber   = 0;
            managerRecord.MaxWheelNumber = 0;
            managerRecord.UpdateTime     = date;
            managerRecord.FightDicId     = 0;
            var fightMap = new LeagueFightMapFrame(managerId);

            using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()))
            {
                transactionManager.BeginTransaction();
                MessageCode messCode = MessageCode.NbUpdateFail;
                do
                {
                    if (point > 0)
                    {
                        messCode = PayCore.Instance.GambleConsume(managerId, 50, ShareUtil.GenerateComb(),
                                                                  EnumConsumeSourceType.LeagueReset, transactionManager.TransactionObject);
                        if (messCode != MessageCode.Success)
                        {
                            break;
                        }
                    }
                    messCode = fightMap.ClearFightMap(transactionManager.TransactionObject);
                    if (messCode != MessageCode.Success)
                    {
                        break;
                    }
                    if (!LeagueManagerrecordMgr.Update(managerRecord, transactionManager.TransactionObject))
                    {
                        break;
                    }
                    messCode = MessageCode.Success;
                } while (false);
                if (messCode != MessageCode.Success)
                {
                    transactionManager.Rollback();
                    return(messCode);
                }
                transactionManager.Commit();
            }
            return(MessageCode.Success);
        }
Beispiel #2
0
 /// <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>());
     }
 }
Beispiel #3
0
        /// <summary>
        /// 重置联赛
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="leagueId"></param>
        /// <returns></returns>
        public MessageCodeResponse ResetLeague(Guid managerId, int leagueId)
        {
            var currectLeague = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId);

            if (currectLeague == null)
            {
                return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbParameterError));
            }

            var leagueWincountRecord = LeagueWincountrecordMgr.GetRecord(managerId, leagueId);

            if (leagueWincountRecord != null)
            {
                //获取所有奖励
                var winPrize = CacheFactory.LeagueCache.GetLeagueStar(leagueId);
                if (winPrize == null || winPrize.Count <= 0)
                {
                    return(ResponseHelper.InvalidParameter <MessageCodeResponse>());
                }
                var prizeStatus = leagueWincountRecord.PrizeStep.Split(',');
                foreach (var item in prizeStatus)
                {
                    if (item == "1")
                    {
                        return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.LeaguePrizeNotGet));
                    }
                }
            }
            int price = 50;

            if (currectLeague.IsPass)
            {
                price = 0;
            }
            int point = PayCore.Instance.GetPoint(managerId);

            if (point < price) //重置联赛消耗点券数
            {
                return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbPointShortage));
            }
            var code = LeagueProcess.Instance.ResetLeague(managerId, leagueId, price);

            return(ResponseHelper.Create <MessageCodeResponse>(code));
        }
Beispiel #4
0
        public LeagueAllPrizeInfoResponse GetAllPrizeInfo(Guid managerId)
        {
            var leagueInfo    = LeagueManagerrecordMgr.GetManagerAllMark(managerId);
            var prizeInfoList = new List <LeagueAllPrizeInfoEntity>();

            foreach (var entity in leagueInfo)
            {
                var prizeInfo = new LeagueAllPrizeInfoEntity();
                prizeInfo.LeagueRecordId = entity.LastPrizeLeagueRecordId;
                prizeInfo.LeagueId       = entity.LaegueId;
                prizeInfo.FirstPass      = !entity.SendFirstPassPrize;
                //已领取过首次通关奖励
                if (entity.SendFirstPassPrize)
                {
                    prizeInfo.Status = 2;
                }
                else
                {
                    //不能领取的
                    if (entity.LastPrizeLeagueRecordId == new Guid())
                    {
                        prizeInfo.Status = 0;
                    }
                    else
                    {
                        prizeInfo.Status = 1;
                    }
                }
                prizeInfoList.Add(prizeInfo);
            }
            var response = ResponseHelper.CreateSuccess <LeagueAllPrizeInfoResponse>();

            response.Data = new LeagueAllPrizeInfoList
            {
                PrizeInfoList = prizeInfoList
            };
            return(response);
        }
Beispiel #5
0
        /// <summary>
        /// 领取赛季奖励
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="leagueRecordId"></param>
        /// <returns></returns>
        public LeaguePrizeResponse GetRankPrize(Guid managerId, Guid leagueRecordId)
        {
            var leagueRecordInfo = LeagueRecordMgr.GetById(leagueRecordId);

            if (leagueRecordInfo == null)
            {
                return(ResponseHelper.Create <LeaguePrizeResponse>(MessageCode.NbParameterError));
            }
            var npcCount = CacheFactory.LeagueCache.GetTeamCount(leagueRecordInfo.LaegueId);
            int maxWheel = npcCount * 2;

            //最后一轮
            if (leagueRecordInfo.Schedule <= maxWheel)
            {
                return(ResponseHelper.Create <LeaguePrizeResponse>(MessageCode.LeagueNoEnd));
            }

            //玩家记录
            var leagueManagerRecord = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId,
                                                                                leagueRecordInfo.LaegueId);

            if (leagueRecordInfo.PrizeTime == DateTime.Today)
            {
                return(ResponseHelper.Create <LeaguePrizeResponse>(MessageCode.LeaguePrizeReceivedToday));
            }

            if (leagueRecordInfo.Rank == 1)                 //冠军奖励
            {
                if (leagueManagerRecord.SendFirstPassPrize) //首次通关才有奖励
                {
                    return(ResponseHelper.Create <LeaguePrizeResponse>(MessageCode.LeaguePrizeReceivedToday));
                }
                leagueManagerRecord.SendFirstPassPrize = true;
                //排名奖励
                var rankPrizes           = LeagueCache.Instance.GetLeaguePrize(leagueRecordInfo.LaegueId, 5);
                int exp                  = 0;
                int coin                 = 0;
                int score                = 0;
                int vipExp               = 0;
                ItemPackageFrame package = null;
                int point                = 0;
                var manager              = ManagerCore.Instance.GetManager(managerId);
                SendPrize(rankPrizes, manager, leagueRecordInfo.LaegueId, ref exp, ref coin, ref score, ref package, ref point, ref vipExp);
                leagueRecordInfo.IsSend     = true;
                leagueRecordInfo.Schedule   = -1;
                leagueRecordInfo.PrizeTime  = DateTime.Today;
                leagueRecordInfo.UpdateTime = DateTime.Now;

                leagueManagerRecord.Score += score;


                var leagueManager = LaegueManagerinfoMgr.GetById(managerId);
                leagueManager.SumScore += score;

                ManagerUtil.AddManagerData(manager, exp, coin, 0, EnumCoinChargeSourceType.LeaguePrize, ShareUtil.CreateSequential().ToString());

                leagueManagerRecord.LastPrizeLeagueRecordId = new Guid();
                using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetConnectionString(EnumDbType.Main)))
                {
                    transactionManager.BeginTransaction();
                    var messageCode = SaveRankPrize(manager, leagueRecordInfo, leagueManagerRecord, leagueManager, package, point, transactionManager.TransactionObject);
                    if (messageCode == MessageCode.Success)
                    {
                        transactionManager.Commit();
                    }
                    else
                    {
                        transactionManager.Rollback();
                        return(ResponseHelper.Create <LeaguePrizeResponse>(messageCode));
                    }
                }
                //leagueManagerRecord.LastPrizeLeagueRecordId = leagueManagerRecord.LeagueRecordId;

                //奖励结果
                var response = ResponseHelper.CreateSuccess <LeaguePrizeResponse>();
                response.Data = new LeaguePrizes
                {
                    PrizeList = new List <LeaguePrizeEntity>()
                };
                foreach (var prize in rankPrizes)
                {
                    var entity = new LeaguePrizeEntity();
                    entity.PrizeType = prize.PrizeType;
                    entity.ItemCode  = prize.PrizeType;
                    entity.Count     = prize.Count;
                    response.Data.PrizeList.Add(entity);
                }
                response.Data.VipExp = vipExp;
                return(response);
            }
            return(ResponseHelper.Create <LeaguePrizeResponse>(MessageCode.LeagueNotChampion));
        }
Beispiel #6
0
        /// <summary>
        /// 确认比赛结果
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="leagueRecordInfo"></param>
        /// <returns></returns>
        public LeaguePrizeResponse MatchConfirm(NbManagerEntity manager, LeagueRecordEntity leagueRecordInfo, LeagueManagerrecordEntity leagueManagerRecord, LaegueManagerinfoEntity lagueManagerInfo, BaseMatchData matchData, LeagueFightMapFrame fightMap, NbManagerextraEntity managerExtra, LeagueWincountrecordEntity leagueWinCount)
        {
            //发放玩家单场比赛奖励---------------------------------------------------
            int winType = 0;

            if (matchData.Home.ManagerId == manager.Idx)         //玩家为主队
            {
                if (matchData.Home.Score > matchData.Away.Score) //主队胜
                {
                    winType = 1;
                }
                else if (matchData.Home.Score == matchData.Away.Score) //平
                {
                    winType = 2;
                }
                else //负
                {
                    winType = 3;
                }
            }
            else //玩家为客队
            {
                if (matchData.Home.Score < matchData.Away.Score)//客队胜
                {
                    winType = 1;
                }
                else if (matchData.Home.Score == matchData.Away.Score) //平
                {
                    winType = 2;
                }
                else//负
                {
                    winType = 3;
                }
            }
            var managerPrizes = LeagueCache.Instance.GetLeaguePrize(leagueRecordInfo.LaegueId, winType);

            int exp   = 0;
            int coin  = 0;
            int score = 0;
            ItemPackageFrame package = null;
            int point  = 0;
            int vipExp = 0;

            SendPrize(managerPrizes, manager, leagueRecordInfo.LaegueId, ref exp, ref coin, ref score, ref package,
                      ref point, ref vipExp);
            ManagerUtil.AddManagerData(manager, exp, coin, 0, EnumCoinChargeSourceType.LeaguePrize, ShareUtil.CreateSequential().ToString());

            if (lagueManagerInfo == null)
            {
                lagueManagerInfo = LaegueManagerinfoMgr.GetById(manager.Idx);
            }
            lagueManagerInfo.SumScore += score;

            leagueManagerRecord.MatchId    = new Guid();
            leagueManagerRecord.UpdateTime = DateTime.Now;
            bool isLastWheel = false;

            leagueManagerRecord.Score += score;
            //本联赛最后一轮
            if (leagueRecordInfo.Schedule >= leagueManagerRecord.MaxWheelNumber)
            {
                isLastWheel = true;
                leagueManagerRecord.IsPass      = true;
                leagueManagerRecord.PassNumber += 1;
            }
            int myRank  = 0;
            int myScore = 0;

            //更新排名
            fightMap.UpdateRankList();
            fightMap.GetRank(ref myRank, ref myScore);

            leagueRecordInfo.Score += score;
            leagueRecordInfo.Rank   = myRank;
            //----------------------------
            leagueRecordInfo.Schedule++;
            leagueRecordInfo.IsSend     = true;
            leagueRecordInfo.UpdateTime = DateTime.Now;
            //本联赛最后一轮,如果是冠军解锁下一轮
            bool isUpdatenextManagerRecord = false;
            LeagueManagerrecordEntity nextManagerRecord = null;

            if (isLastWheel)
            {
                if (leagueRecordInfo.Rank == 1)
                {
                    leagueManagerRecord.LastPrizeLeagueRecordId = leagueManagerRecord.LeagueRecordId;
                    if (leagueRecordInfo.LaegueId != 8)
                    {
                        nextManagerRecord = LeagueManagerrecordMgr.GetManagerMarkInfo(manager.Idx,
                                                                                      leagueRecordInfo.LaegueId + 1);
                        nextManagerRecord.IsLock  = false;
                        isUpdatenextManagerRecord = true;
                    }
                    //记录成就相关数据
                    AchievementTaskCore.Instance.UpdateLeagueScore(manager.Idx, leagueRecordInfo.LaegueId,
                                                                   myScore);
                    TaskHandler.Instance.LeagueChampionScore(manager.Idx);
                }
            }

            using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetConnectionString(EnumDbType.Main)))
            {
                transactionManager.BeginTransaction();
                var messageCode = SaveMatchConfirm(manager, package, leagueRecordInfo,
                                                   nextManagerRecord, leagueManagerRecord, point, isUpdatenextManagerRecord, lagueManagerInfo, fightMap, managerExtra, leagueWinCount, transactionManager.TransactionObject);
                if (messageCode == MessageCode.Success)
                {
                    transactionManager.Commit();
                }
                else
                {
                    transactionManager.Rollback();
                    return(ResponseHelper.Create <LeaguePrizeResponse>(messageCode));
                }
            }
            //奖励结果
            var response = ResponseHelper.CreateSuccess <LeaguePrizeResponse>();

            response.Data = new LeaguePrizes
            {
                PrizeList = new List <LeaguePrizeEntity>()
            };
            foreach (var prize in managerPrizes)
            {
                var entity = new LeaguePrizeEntity();
                entity.PrizeType = prize.PrizeType;
                entity.ItemCode  = prize.ItemCode;
                entity.Count     = prize.Count;
                response.Data.PrizeList.Add(entity);
            }
            response.Data.VipExp = vipExp;
            return(response);
        }
Beispiel #7
0
        /// <summary>
        /// 开启一个新的联赛
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="leagueId"></param>
        /// <param name="leagueManagerRecord"></param>
        /// <returns></returns>
        public MessageCode StartLeague(Guid managerId, int leagueId, ref LeagueManagerrecordEntity leagueManagerRecord)
        {
            var recordList = LeagueManagerrecordMgr.GetManagerAllMark(managerId);

            foreach (var record in recordList)
            {
                if (record.LaegueId == leagueId)
                {
                    leagueManagerRecord = record;
                }
                if (record.IsStart)
                {
                    return(MessageCode.LeagueHasStart);
                }
            }
            if (leagueManagerRecord == null)
            {
                return(MessageCode.NbParameterError);
            }
            if (leagueManagerRecord.IsLock)
            {
                return(MessageCode.LeagueIdMarkNotLock);
            }
            #region 去掉等级限制
            //var openLevel= LeagueCache.Instance.GetLeagueOpenLevel(leagueId);
            //if (openLevel == -1)
            //    return MessageCode.NbParameterError;
            //var manager = ManagerCore.Instance.GetManager(managerId);
            //if(manager==null)
            //    return MessageCode.NbParameterError;
            //if(manager.Level<openLevel)
            //    return MessageCode.LeagueIdMarkNotLock;
            #endregion
            DateTime date           = DateTime.Now;
            var      leagueRecordId = ShareUtil.GenerateComb();
            leagueManagerRecord.LeagueRecordId = leagueRecordId;
            //info.LastPrizeLeagueRecordId = new Guid();
            leagueManagerRecord.IsPass       = false;
            leagueManagerRecord.IsStart      = true;
            leagueManagerRecord.MatchNumber  = 0;
            leagueManagerRecord.Score        = 0;
            leagueManagerRecord.WinNumber    = 0;
            leagueManagerRecord.FlatNumber   = 0;
            leagueManagerRecord.LoseNumber   = 0;
            leagueManagerRecord.GoalsNumber  = 0;
            leagueManagerRecord.FumbleNumber = 0;
            leagueManagerRecord.UpdateTime   = date;

            var npcCount   = CacheFactory.LeagueCache.GetTeamCount(leagueId);
            var templateId = CacheFactory.LeagueCache.GetTemplateId(npcCount + 1);
            leagueManagerRecord.MaxWheelNumber = npcCount * 2;//总轮数
            leagueManagerRecord.FightDicId     = templateId;

            LeagueRecordEntity entity = new LeagueRecordEntity(leagueRecordId, managerId, leagueId, 1, 0, 0, false, date, date, ShareUtil.BaseTime);
            entity.Idx        = leagueRecordId;
            entity.ManagerId  = managerId;
            entity.LaegueId   = leagueId;
            entity.IsSend     = false;
            entity.Rank       = -1;
            entity.RowTime    = date;
            entity.Schedule   = 1;
            entity.UpdateTime = date;
            entity.Score      = 0;
            var leagueWinCount = LeagueWincountrecordMgr.GetRecord(managerId, leagueId);
            if (leagueWinCount != null)
            {
                if (leagueWinCount.PrizeDate.Date != DateTime.Now.Date)
                {
                    leagueWinCount.WinCount1Status = 0;
                    leagueWinCount.WinCount2Status = 0;
                    leagueWinCount.WinCount3Status = 0;
                    leagueWinCount.UpdateTime      = DateTime.Now;
                    leagueWinCount.PrizeDate       = DateTime.Now;
                    leagueWinCount.PrizeStep       = "0,0,0,0,0";
                }
                leagueWinCount.MaxWinCount = 0;
            }
            //更新当前联赛记录
            if (!LeagueManagerrecordMgr.Update(leagueManagerRecord))
            {
                return(MessageCode.FailUpdate);
            }
            if (!LeagueRecordMgr.Insert(entity))
            {
                return(MessageCode.FailUpdate);
            }
            var figMap = new LeagueFightMapFrame(managerId);
            figMap.ClearFightMapStartLeague(npcCount + 1);
            if (leagueWinCount != null)
            {
                if (!LeagueWincountrecordMgr.Update(leagueWinCount))
                {
                    return(MessageCode.FailUpdate);
                }
            }
            return(MessageCode.Success);
        }
Beispiel #8
0
        /// <summary>
        ///  联赛打比赛
        /// </summary>
        /// <param name="leagueId"></param>
        /// <param name="managerId"></param>
        /// <returns></returns>
        public LeagueFightResultResponse Fight(Guid managerId, int leagueId)
        {
            var manager = ManagerCore.Instance.GetManager(managerId);

            if (manager == null)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError));
            }
            var managerExtra = ManagerCore.Instance.GetManagerExtra(managerId);

            if (managerExtra == null)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError));
            }
            if (managerExtra.Stamina < 5)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.LeagueStaminaNotEnough));
            }
            var currectLeague = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId);

            if (currectLeague == null)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError));
            }
            var leagueRecordInfo = LeagueRecordMgr.GetById(currectLeague.LeagueRecordId);

            if (leagueRecordInfo == null)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.NbParameterError));
            }
            if (leagueRecordInfo.Schedule > currectLeague.MaxWheelNumber)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.LeagueHavePass));
            }
            //扣除行动力
            var code = ManagerCore.Instance.SubStamina(managerExtra, 5, manager.Level, manager.VipLevel);

            if (code != MessageCode.Success)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(code));
            }
            //遍历对阵
            int botStatus = 0;//0=主队和客队都是NPC 1 我是主队 2 我是客队
            var npchome   = Guid.Empty;
            var npcaway   = Guid.Empty;
            var matchId   = ShareUtil.GenerateComb();
            //获取对阵记录
            var fightMap = new LeagueFightMapFrame(managerId);
            //获取对阵
            var           pairList     = CreateFightMap(currectLeague.FightDicId, leagueRecordInfo.Schedule);
            BaseMatchData managerMatch = null;

            foreach (var item in pairList)
            {
                botStatus = 0;
                if (item.HomeId == 0)
                {
                    botStatus = 1;
                    npchome   = managerId;
                    npcaway   = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.AwayId);
                }
                else if (item.AwayId == 0)
                {
                    botStatus = 2;
                    npchome   = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.HomeId);
                    npcaway   = managerId;
                }
                else
                {
                    npchome = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.HomeId);
                    npcaway = CacheFactory.LeagueCache.GetLeagueNpcGuid(leagueId, item.AwayId);
                }
                SingleMatch(leagueRecordInfo.Schedule, npchome, npcaway, item.HomeId, item.AwayId, leagueRecordInfo.LaegueId, matchId, botStatus, fightMap, ref managerMatch);
            }
            if (managerMatch == null)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(MessageCode.MatchCreateFail));
            }
            LeagueWincountrecordEntity leagueWincountRecord = null;


            //记录比赛数据
            if (managerMatch.Away.IsBot)
            {
                MatchCore.SaveMatchStat(managerId, EnumMatchType.League, managerMatch.Home.Score, managerMatch.Away.Score, managerMatch.Home.Score);
            }
            else
            {
                MatchCore.SaveMatchStat(managerId, EnumMatchType.League, managerMatch.Away.Score, managerMatch.Home.Score, managerMatch.Away.Score);
            }
            var response = ResponseHelper.CreateSuccess <LeagueFightResultResponse>();

            response.Data = new LeagueFightResult
            {
                HomeGoals = managerMatch.Home.Score,
                AwayGoals = managerMatch.Away.Score,
                PrizeList = new List <LeaguePrizeEntity>()
            };
            int star = 0;

            if (managerMatch.Home.Score > managerMatch.Away.Score)
            {
                if (managerMatch.Home.ManagerId == managerId)
                {
                    star = managerMatch.Home.Score - managerMatch.Away.Score;
                    response.Data.Result = 0;
                }
                else
                {
                    response.Data.Result = 2;
                }
            }

            else if (managerMatch.Home.Score == managerMatch.Away.Score)
            {
                response.Data.Result = 1;
            }
            else
            {
                if (managerMatch.Away.ManagerId == managerId)
                {
                    star = managerMatch.Away.Score - managerMatch.Home.Score;
                    response.Data.Result = 0;
                }
                else
                {
                    response.Data.Result = 2;
                }
            }
            var winType = CalWinType(response.Data.Result);
            LaegueManagerinfoEntity leagueManagerInfo = null;

            if (winType == EnumWinType.Win)
            {
                leagueManagerInfo = LaegueManagerinfoMgr.GetById(managerId);
                if (leagueManagerInfo.DailyWinUpdateTime.Date != DateTime.Now.Date)
                {
                    leagueManagerInfo.DailyWinCount = 1;
                }
                else
                {
                    leagueManagerInfo.DailyWinCount++;
                }
                leagueManagerInfo.DailyWinUpdateTime = DateTime.Now;
            }

            //更新胜场奖励
            star = star > 3 ? 3 : star;
            star = star < 0 ? 0 : star;
            UpdateWincountRecord(managerId, leagueId, star, ref leagueWincountRecord);
            currectLeague.MatchId    = matchId;
            currectLeague.UpdateTime = DateTime.Now;
            var result = MatchConfirm(manager, leagueRecordInfo, currectLeague, leagueManagerInfo, managerMatch, fightMap, managerExtra, leagueWincountRecord);

            if (result.Code != (int)MessageCode.Success)
            {
                return(ResponseHelper.Create <LeagueFightResultResponse>(result.Code));
            }
            var pop = TaskHandler.Instance.LeagueFight(managerId, (int)winType);

            if (pop != null)
            {
                MemcachedFactory.MatchPopClient.Set(managerId, pop);
            }
            response.Data.StarNumber = star;
            response.Data.Stamina    = managerExtra.Stamina;
            response.Data.PrizeList  = result.Data.PrizeList;
            response.Data.VipExp     = result.Data.VipExp;
            response.Data.MatchId    = managerMatch.MatchId;
            return(response);
        }