Exemple #1
0
 private MessageCode SaveRankPrize(NbManagerEntity manager, LeagueRecordEntity leagueRecord, LeagueManagerrecordEntity mLeagueRecord, LaegueManagerinfoEntity leagueManagerinfo, ItemPackageFrame package, int point, DbTransaction trans)
 {
     if (!ManagerUtil.SaveManagerData(manager, null, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!LeagueRecordMgr.Update(leagueRecord, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!LeagueManagerrecordMgr.Update(mLeagueRecord, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!LaegueManagerinfoMgr.Update(leagueManagerinfo, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (package != null)
     {
         if (!package.Save(trans))
         {
             return(MessageCode.NbUpdateFail);
         }
         package.Shadow.Save();
     }
     if (point > 0)
     {
         var code = PayCore.Instance.AddBonus(manager.Idx, point, EnumChargeSourceType.LeaguePrize,
                                              ShareUtil.GenerateComb().ToString(), trans);
         return(code);
     }
     return(MessageCode.Success);
 }
Exemple #2
0
 private MessageCode SaveMatchConfirm(NbManagerEntity manager, ItemPackageFrame package, LeagueRecordEntity leagueRecordInfo,
                                      LeagueManagerrecordEntity nextManagerRecord, LeagueManagerrecordEntity leagueManagerRecord, int point,
                                      bool isUpdatenextManagerRecord, LaegueManagerinfoEntity leagueManagerInfo, LeagueFightMapFrame fightMap, NbManagerextraEntity managerExtra, LeagueWincountrecordEntity leagueWinCount, DbTransaction trans)
 {
     if (!ManagerUtil.SaveManagerData(manager, managerExtra, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!NbManagerextraMgr.Update(managerExtra, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (package != null)
     {
         if (!package.Save(trans))
         {
             return(MessageCode.NbUpdateFail);
         }
         package.Shadow.Save();
     }
     if (!LeagueRecordMgr.Update(leagueRecordInfo, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (isUpdatenextManagerRecord)
     {
         if (nextManagerRecord != null)
         {
             if (!LeagueManagerrecordMgr.Update(nextManagerRecord, trans))
             {
                 return(MessageCode.NbUpdateFail);
             }
         }
     }
     if (!LaegueManagerinfoMgr.Update(leagueManagerInfo, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!LeagueManagerrecordMgr.Update(leagueManagerRecord, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (point > 0)
     {
         var code = PayCore.Instance.AddBonus(manager.Idx, point, EnumChargeSourceType.LeaguePrize,
                                              ShareUtil.GenerateComb().ToString(), trans);
         return(code);
     }
     if (!fightMap.SaveFIghtMap(trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!LeagueWincountrecordMgr.Update(leagueWinCount, trans))
     {
         return(MessageCode.NbUpdateFail);
     }
     return(MessageCode.Success);
 }
Exemple #3
0
 MessageCode Tran_SaveExchange(DbTransaction transaction, LaegueManagerinfoEntity leagueManager, ItemPackageFrame package, LeagueExchangerecordEntity leagueExchangerecord)
 {
     if (!LaegueManagerinfoMgr.Update(leagueManager, transaction))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!package.Save(transaction))
     {
         return(MessageCode.NbUpdateFail);
     }
     if (!LeagueExchangerecordMgr.Insert(leagueExchangerecord, transaction))
     {
         return(MessageCode.NbUpdateFail);
     }
     return(MessageCode.Success);
 }
Exemple #4
0
        //获取联赛积分商城数据
        public LaegueManagerinfoResponse GetLeagueMallInfo(Guid managerId)
        {
            var manager = ManagerCore.Instance.GetManager(managerId);

            if (manager == null)
            {
                return(ResponseHelper.InvalidParameter <LaegueManagerinfoResponse>());
            }

            var leagueManager = LaegueManagerinfoMgr.GetById(managerId);

            if (leagueManager == null)
            {
                return(ResponseHelper.InvalidParameter <LaegueManagerinfoResponse>());
            }

            if (string.IsNullOrEmpty(leagueManager.ExchangeIds) || CheckExchangeRefresh(leagueManager.RefreshDate))
            {
                var    equipmentProperties = "";
                var    equipmentItemcode   = "";
                bool   isReplace           = false;
                string codeString          = "";
                if (!string.IsNullOrEmpty(leagueManager.ExchangeIds) && leagueManager.RefreshDate.Month != DateTime.Now.Month)
                {
                    isReplace = true;
                    var itemList = leagueManager.ExchangeIds.Split('|');
                    foreach (var item in itemList)
                    {
                        var itemcode = item.Split(',')[1];
                        if (itemcode.IndexOf("39") == 0)
                        {
                            codeString += item + "|";
                        }
                    }
                    if (codeString.Length > 0)
                    {
                        codeString = codeString.Substring(0, codeString.Length - 1);
                    }
                }
                leagueManager.ExchangeIds         = CacheFactory.LeagueCache.GetExchanges(manager.Level >= 60, out equipmentItemcode, out equipmentProperties, isReplace, codeString);
                leagueManager.RefreshDate         = DateTime.Now;
                leagueManager.RefreshTimes        = 0;
                leagueManager.ExchangedIds        = "";
                leagueManager.EquipmentProperties = equipmentProperties;
                leagueManager.EquipmentItems      = equipmentItemcode;
                LaegueManagerinfoMgr.Update(leagueManager);
            }

            var response = ResponseHelper.CreateSuccess <LaegueManagerinfoResponse>();

            response.Data = leagueManager;
            response.Data.RefreshPoint =
                CacheFactory.MallCache.GetDirectPoint(EnumConsumeSourceType.RefreshLeagueExchange, leagueManager.RefreshTimes + 1);
            response.Data.AllEquipmentProperties =
                CacheFactory.LeagueCache.AnalysisProperties(leagueManager.EquipmentProperties);
            DateTime date = DateTime.Now;

            if (DateTime.Now.Hour >= 21)
            {
                date = DateTime.Today.AddDays(1).AddHours(21);//每天21点刷新
            }
            else
            {
                date = DateTime.Today.AddHours(21);
            }
            response.Data.NextRefreshTick = ShareUtil.GetTimeTick(date);
            return(response);
        }
Exemple #5
0
        public LeagueExchangeResponse Exchange(Guid managerId, string exchangeKey)
        {
            var manager = LaegueManagerinfoMgr.GetById(managerId);

            if (manager == null || string.IsNullOrEmpty(manager.ExchangeIds) ||
                !manager.ExchangeIds.Contains(exchangeKey))
            {
                return(ResponseHelper.InvalidParameter <LeagueExchangeResponse>());
            }
            var exchangeCache = CacheFactory.LeagueCache.GetExchangeEntity(exchangeKey);

            if (exchangeCache == null)
            {
                return(ResponseHelper.InvalidParameter <LeagueExchangeResponse>());
            }

            if (manager.ExchangedIds.Contains(exchangeKey))
            {
                return(ResponseHelper.Create <LeagueExchangeResponse>(MessageCode.LeagueExchangeTimesOver));
            }

            if (manager.SumScore < exchangeCache.CostScore)
            {
                return(ResponseHelper.Create <LeagueExchangeResponse>(MessageCode.LeagueExchangeHonorShortage));
            }
            var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.LeagueExchange);

            var itemcode           = exchangeCache.ItemCode;
            var exchanagerItemCode = Convert.ToInt32(exchangeKey.Split(',')[1]);

            if (exchangeCache.ItemCode != exchanagerItemCode)
            {
                itemcode = exchanagerItemCode;
            }

            var itemInfo = CacheFactory.ItemsdicCache.GetItem(itemcode);
            var code     = MessageCode.Success;

            if (itemInfo.ItemType == (int)EnumItemType.Equipment)
            {
                var allEquipmentProperties = CacheFactory.LeagueCache.AnalysisProperties(manager.EquipmentProperties);
                var property = GetEquipmentProperty(manager.EquipmentItems, allEquipmentProperties, itemcode);
                code = package.AddEquipment(itemcode, true, false, property);
            }
            else
            {
                code = package.AddItem(itemcode, true, false);
            }
            if (code != MessageCode.Success)
            {
                return(ResponseHelper.Create <LeagueExchangeResponse>(code));
            }
            manager.SumScore     = manager.SumScore - exchangeCache.CostScore;
            manager.UpdateTime   = DateTime.Now;
            manager.ExchangedIds = manager.ExchangedIds + "|" + exchangeKey;

            var record = new LeagueExchangerecordEntity()
            {
                CostScore = exchangeCache.CostScore,
                ItemCode  = itemcode,
                ManagerId = managerId,
                RowTime   = DateTime.Now
            };

            code = SaveExchange(manager, package, record);
            if (code != MessageCode.Success)
            {
                return(ResponseHelper.Create <LeagueExchangeResponse>(code));
            }
            else
            {
                package.Shadow.Save();
                var response = ResponseHelper.CreateSuccess <LeagueExchangeResponse>();
                response.Data = new LeagueExchangeEntity {
                    CurScore = manager.SumScore, ItemCode = itemcode
                };
                return(response);
            }
        }
Exemple #6
0
        public LaegueRefreshExchangeResponse RefreshExchange(Guid managerId)
        {
            var manager = ManagerCore.Instance.GetManager(managerId);

            if (manager == null)
            {
                return(ResponseHelper.InvalidParameter <LaegueRefreshExchangeResponse>());
            }

            var entity = LaegueManagerinfoMgr.GetById(managerId);

            entity.RefreshTimes++;
            var mallDirect = new MallDirectFrame(managerId, EnumConsumeSourceType.RefreshLeagueExchange, entity.RefreshTimes);
            var checkCode  = mallDirect.Check();

            if (checkCode != MessageCode.Success)
            {
                return(ResponseHelper.Create <LaegueRefreshExchangeResponse>(checkCode));
            }
            var    equipmentProperties = "";
            var    equipmentItemcode   = "";
            string codeString          = "";

            var leagueManager = LaegueManagerinfoMgr.GetById(managerId);

            if (leagueManager == null)
            {
                return(ResponseHelper.InvalidParameter <LaegueRefreshExchangeResponse>());
            }

            if (!string.IsNullOrEmpty(leagueManager.ExchangeIds))
            {
                var itemList = leagueManager.ExchangeIds.Split('|');
                foreach (var item in itemList)
                {
                    var itemcode = item.Split(',')[1];
                    if (itemcode.IndexOf("39") == 0)
                    {
                        codeString += item + "|";
                    }
                }
                if (codeString.Length > 0)
                {
                    codeString = codeString.Substring(0, codeString.Length - 1);
                }
            }

            entity.ExchangeIds         = CacheFactory.LeagueCache.GetExchanges(manager.Level >= 60, out equipmentItemcode, out equipmentProperties, true, codeString);
            entity.ExchangedIds        = "";
            entity.EquipmentProperties = equipmentProperties;
            entity.EquipmentItems      = equipmentItemcode;
            using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()))
            {
                transactionManager.BeginTransaction();
                checkCode = mallDirect.Save(Guid.NewGuid().ToString(), transactionManager.TransactionObject);
                if (checkCode != MessageCode.Success)
                {
                    transactionManager.Rollback();
                    return(ResponseHelper.Create <LaegueRefreshExchangeResponse>(checkCode));
                }
                if (!LaegueManagerinfoMgr.Update(entity, transactionManager.TransactionObject))
                {
                    transactionManager.Rollback();
                    return(ResponseHelper.Create <LaegueRefreshExchangeResponse>(MessageCode.NbUpdateFail));
                }
                transactionManager.Commit();
            }
            var      response = ResponseHelper.CreateSuccess <LaegueRefreshExchangeResponse>();
            DateTime date     = DateTime.Now;

            if (DateTime.Now.Hour >= 21)
            {
                date = DateTime.Today.AddDays(1).AddHours(21);//每天21点刷新
            }
            else
            {
                date = DateTime.Today.AddHours(21);
            }
            response.Data = new LeagueRefreshExchangeEntity
            {
                ExchangeIds  = entity.ExchangeIds,
                ManagerPoint = mallDirect.RemainPoint,
                SumScore     = entity.SumScore,
                RefreshPoint =
                    CacheFactory.MallCache.GetDirectPoint(EnumConsumeSourceType.RefreshLeagueExchange,
                                                          entity.RefreshTimes + 1),
                AllEquipmentProperties = CacheFactory.LeagueCache.AnalysisProperties(entity.EquipmentProperties),
                NextRefreshTick        = ShareUtil.GetTimeTick(date)
            };
            return(response);
        }
Exemple #7
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));
        }
Exemple #8
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);
        }
Exemple #9
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);
        }