Beispiel #1
0
        MessageCode Tran_SaveMatch(DbTransaction transaction, NbManagerEntity manager, NbManagerextraEntity managerex, BaseMatchData pkmatchData,
                                   Guid lotteryMatchId, int win, int lose, int draw, int prizeExp, int prizeCoin, int prizeItemCode, string prizeItemString
                                   , bool isrevenge, long revengeRecordId, ref long outRevengeRecordId, PlayerkillInfoEntity info, int prizeItemCount)
        {
            if (prizeCoin > 0 || prizeExp > 0)
            {
                if (!ManagerUtil.SaveManagerData(manager, managerex, transaction))
                {
                    return(MessageCode.NbUpdateFail);
                }
                else
                {
                    ManagerUtil.SaveManagerAfter(manager, managerex, transaction);
                }
                if (!NbManagerextraMgr.Update(managerex, transaction))
                {
                    return(MessageCode.NbUpdateFail);
                }
            }
            PlayerkillInfoMgr.Update(info);
            PlayerkillInfoMgr.SaveFightResult(pkmatchData.Home.ManagerId, manager.Logo, pkmatchData.Away.ManagerId, lotteryMatchId,
                                              win, lose, draw, DateTime.Now,
                                              pkmatchData.MatchId, pkmatchData.Home.Name, pkmatchData.Away.Name,
                                              pkmatchData.Home.Score, pkmatchData.Away.Score, prizeExp, prizeCoin,
                                              prizeItemCode
                                              , prizeItemString, isrevenge, revengeRecordId, prizeItemCount, ref outRevengeRecordId, transaction);

            return(MessageCode.Success);
        }
Beispiel #2
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);
 }
Beispiel #3
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);
 }
Beispiel #4
0
        public static void ChargeAfter(string account, int point, int needPoint, DateTime curTime)
        {
            try
            {
                PayContinuingMgr.UpdateContinueday(account, point, needPoint, curTime.Date.AddDays(-1), curTime.Date, curTime);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpContinue", ex);
            }
            var manager = ManagerCore.Instance.GetManager(account);

            try
            {
                if (manager != null)
                {
                    var payUser = PayUserMgr.GetById(account);
                    if (payUser == null)
                    {
                        payUser = new PayUserEntity(account, 0, 0, 0, DateTime.Now, new byte[0], point, 0);
                    }
                    var curScore   = payUser.ChargePoint;
                    var vipManager = VipManagerMgr.GetById(manager.Idx);
                    if (vipManager != null)
                    {
                        curScore += vipManager.VipExp;
                        //  VipManagerMgr.Update(vipManager);
                    }

                    var newlevel = CacheFactory.VipdicCache.GetVipLevel(curScore);
                    if (newlevel > manager.VipLevel)
                    {
                        manager.VipLevel = newlevel;
                        ManagerUtil.SaveManagerData(manager);
                        ManagerCore.Instance.DeleteCache(manager.Idx);
                    }
                    // ChatHelper.SendUpdateManagerInfoPop(manager.Idx, payUser.TotalPoint, true, manager.VipLevel);
                    if (point > 0)
                    {
                        ActivityExThread.Instance.Charge(manager.Idx, account, point);
                        ActivityExThread.Instance.Charge(manager.Idx, point);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpVip", ex);
            }
        }
Beispiel #5
0
        public static void ChargeAfter(string account, int point, int needPoint, DateTime curTime, decimal cash,
                                       int vipExp)
        {
            try
            {
                PayContinuingMgr.UpdateContinueday(account, point, needPoint, curTime.Date.AddDays(-1), curTime.Date,
                                                   curTime);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpContinue", ex);
            }
            var  payUser  = PayUserMgr.GetById(account);
            bool isInsert = false;

            if (payUser == null)
            {
                isInsert = true;
                payUser  = new PayUserEntity(account, 0, 0, cash, DateTime.Now, new byte[0], point, 0);
            }
            else
            {
                payUser.TotalCash  += cash;
                payUser.ChargePoint = point;
            }
            try
            {
                if (isInsert)
                {
                    if (!PayUserMgr.Insert(payUser))
                    {
                        SystemlogMgr.Error("charetUpPayUser", "统计钱失败", "Account:" + account + "_Cash" + cash);
                    }
                }
                else
                {
                    if (!PayUserMgr.Update(payUser))
                    {
                        SystemlogMgr.Error("charetUpPayUser", "统计钱失败", "Account:" + account + "_Cash" + cash);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("charetUpPayUser" + cash, ex);
            }
            var manager = ManagerCore.Instance.GetManager(account);

            try
            {
                if (manager != null)
                {
                    var curScore   = vipExp;
                    var vipManager = VipManagerMgr.GetById(manager.Idx);
                    if (vipManager != null)
                    {
                        curScore         += vipManager.VipExp;
                        vipManager.VipExp = curScore;
                        VipManagerMgr.Update(vipManager);
                    }
                    else
                    {
                        vipManager = new VipManagerEntity(manager.Idx, curScore, DateTime.Now, DateTime.Now,
                                                          DateTime.Now);
                        VipManagerMgr.Insert(vipManager);
                    }

                    var newlevel = CacheFactory.VipdicCache.GetVipLevel(curScore);
                    if (newlevel > manager.VipLevel)
                    {
                        manager.VipLevel = newlevel;
                        ManagerUtil.SaveManagerData(manager);
                        ManagerCore.Instance.DeleteCache(manager.Idx);
                    }
                    // ChatHelper.SendUpdateManagerInfoPop(manager.Idx, payUser.TotalPoint, true, manager.VipLevel);

                    ActivityExThread.Instance.Charge(manager.Idx, account, vipExp);
                    ActivityExThread.Instance.Charge(manager.Idx, vipExp);
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpVip", ex);
            }
        }
Beispiel #6
0
        void GmVip(string account, int point, int needPoint, DateTime curTime)
        {
            try
            {
                PayContinuingMgr.UpdateContinueday(account, point, needPoint, curTime.Date.AddDays(-1), curTime.Date, curTime);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpContinue", ex);
            }
            var manager = ManagerCore.Instance.GetManager(account);

            try
            {
                if (manager != null)
                {
                    int totalPoint = 0;
                    PayUserMgr.GetGmChargePoint(account, ref totalPoint);
                    var payUser    = PayUserMgr.GetById(account);
                    var curScore   = totalPoint;
                    var vipManager = VipManagerMgr.GetById(manager.Idx);
                    if (vipManager != null && vipManager.VipExp > 0)
                    {
                        curScore += vipManager.VipExp;
                    }

                    var newlevel = CacheFactory.VipdicCache.GetVipLevel(curScore);
                    if (newlevel > manager.VipLevel)
                    {
                        manager.VipLevel = newlevel;
                        ManagerUtil.SaveManagerData(manager);
                        ManagerCore.Instance.DeleteCache(manager.Idx);
                    }
                    //ChatHelper.SendUpdateManagerInfoPop(manager.Idx, payUser.TotalPoint, true, manager.VipLevel);
                    if (point > 0)
                    {
                        ActivityExThread.Instance.Charge(manager.Idx, account, point);
                        ActivityExThread.Instance.Charge(manager.Idx, point);
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeUpVip", ex);
            }
            try
            {
                if (manager != null)
                {
                    int returnPoint = point;

                    //BuffPlusHelper.ChargeReturn50(ref returnPoint);
                    if (returnPoint > 0)
                    {
                        //var mail = new MailBuilder(manager.Idx, EnumMailType.ChargeReturn50, returnPoint);
                        //mail.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("ChargeReturnDouble", ex);
            }
        }
Beispiel #7
0
        public MessageCode MatchCallback(BaseMatchData matchData, long revengeRecordId, PlayerKillOpponentEntity awayOpp, PlayerkillInfoEntity info)
        {
            var pkmatchData = matchData;

            if (pkmatchData == null || pkmatchData.ErrorCode != (int)MessageCode.Success)
            {
                return(MessageCode.MatchCreateFail);
            }
            bool isrevenge      = false;
            Guid lotteryMatchId = Guid.Empty;

            var winType = ShareUtil.CalWinType(pkmatchData.Home.Score, pkmatchData.Away.Score);

            int win       = 0;
            int lose      = 0;
            int draw      = 0;
            int prizeExp  = 0;
            int prizeCoin = 0;

            if (!isrevenge)
            {
                if (winType == EnumWinType.Win)
                {
                    win = 1;
                }
                if (winType == EnumWinType.Lose)
                {
                    lose = 1;
                }
                if (winType == EnumWinType.Draw)
                {
                    draw = 1;
                }
                var prize = CacheFactory.PlayerKillCache.GetPrize(winType);
                prizeCoin = prize.Coin;
                prizeExp  = prize.Exp;
            }
            int    prizeItemCode   = 0;
            string prizeItemString = "";
            var    manager         = ManagerCore.Instance.GetManager(pkmatchData.Home.ManagerId);
            var    managerex       = ManagerCore.Instance.GetManagerExtra(pkmatchData.Home.ManagerId);

            var subtype = 1;

            if (manager.Level % 10 == 0)
            {
                subtype = manager.Level / 10;
            }
            else
            {
                subtype = manager.Level / 10 + 1;
            }

            int matchTimes = 0;

            PlayerkillInfoMgr.GetMatchTimes(manager.Idx, ref matchTimes);

            //if (winType == EnumWinType.Win)
            //{
            var lotteryEntity = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.PlayerKill, subtype);
            int pointCount    = 0;

            if (lotteryEntity != null)
            {
                //第一场友谊赛固定获得5钻石
                if (matchTimes == 0)
                {
                    prizeItemCode  = 810001;
                    pointCount     = 5;
                    lotteryMatchId = pkmatchData.MatchId;
                }
                else
                {
                    if (winType == EnumWinType.Win)
                    {
                        prizeItemCode   = lotteryEntity.PrizeItemCode;
                        prizeItemString = lotteryEntity.ItemString;
                        if (prizeItemCode == 810001)
                        {
                            var pointConfig = CacheFactory.PlayerKillCache.GetPointConfig(manager.VipLevel);
                            if (pointConfig != null && (info.DayPoint + pointCount) < pointConfig.TotalPoint)
                            {
                                pointCount = pointConfig.PrizePoint;
                                int point = pointCount;
                                //欧洲杯狂欢
                                ActivityExThread.Instance.EuropeCarnival(5, ref point);
                                info.DayPoint = info.DayPoint + point;
                                info.DayPoint = info.DayPoint > pointConfig.TotalPoint ? pointConfig.TotalPoint : info.DayPoint;
                            }
                            else
                            {
                                prizeItemCode = 910001;
                                pointCount    = 5;
                            }
                        }
                        else if (prizeItemCode == 910001)
                        {
                            prizeItemCode = 910001;
                            pointCount    = 5;
                        }
                        var itemcode = ActivityExThread.Instance.SummerGiftBag(4);
                        if (itemcode > 0)
                        {
                            prizeItemCode = itemcode;
                        }
                        else
                        {
                            itemcode = ActivityExThread.Instance.MidAutumnActivity(4, info.SpecialItemNumber);
                            if (itemcode > 0)
                            {
                                info.SpecialItemNumber++;
                                prizeItemCode = itemcode;
                            }
                        }
                        lotteryMatchId = pkmatchData.MatchId;
                    }
                }
            }
            //}



            //LogHelper.Insert("友谊赛比赛结果处理请求:比赛id"+lotteryMatchId+",ManagerId:" + pkmatchData.Home.ManagerId.ToString() + " ,对手Id:" + pkmatchData.Away.ManagerId.ToString(), LogType.Info);

            double totalPlusRate = 0;
            //是否有vip效果
            var vipRate = CacheFactory.VipdicCache.GetEffectValue(manager.VipLevel, EnumVipEffect.PkOrLeagueExpPlus);

            totalPlusRate += vipRate / 100.00;
            //是否有增加经验的Buff
            var buffExp = BuffPoolCore.Instance().GetBuffValue(manager.Idx, EnumBuffCode.PkMatchExp, true, false);
            NbManagerbuffpoolEntity buffExpEntity = null;

            if (buffExp != null)
            {
                if (buffExp.SrcList != null && buffExp.SrcList.Count > 0)
                {
                    buffExpEntity = NbManagerbuffpoolMgr.GetById(buffExp.SrcList[0].Idx);
                    if (buffExpEntity != null && buffExpEntity.RemainTimes > 0)
                    {
                        totalPlusRate += buffExp.Percent;
                    }
                }
            }
            prizeExp = (int)(prizeExp * (1 + totalPlusRate));

            if (matchData.Home.Score > matchData.Away.Score)
            {
                awayOpp.HasWin    = true;
                info.OpponentInfo = SerializationHelper.ToByte(info.Opponents);
                //PlayerkillInfoMgr.Update(info);
            }

            //欧洲杯狂欢
            ActivityExThread.Instance.EuropeCarnival(1, ref prizeExp);

            LogHelper.Insert(string.Format("revengeId:{0},score1:{1},score2:{2},haswin:{3}", revengeRecordId, matchData.Home.Score, matchData.Away.Score, awayOpp.HasWin), LogType.Info);
            OnlineCore.Instance.CalIndulgePrize(manager, ref prizeExp, ref prizeCoin);
            ManagerUtil.AddManagerData(manager, prizeExp, prizeCoin, 0, EnumCoinChargeSourceType.PlayerKillPrize, pkmatchData.MatchId.ToString());
            long outRevengeRecordId = 0;
            //扣除行动力
            var code = ManagerCore.Instance.SubStamina(managerex, _pkStamina, manager.Level, manager.VipLevel);

            if (code != MessageCode.Success)
            {
                return(code);
            }

            code = SaveMatch(manager, managerex, pkmatchData, lotteryMatchId, win, lose, draw, prizeExp, prizeCoin,
                             prizeItemCode, prizeItemString, isrevenge, revengeRecordId, ref outRevengeRecordId, info, pointCount);
            //统计使用的行动力
            StatisticKpiMgr.UpdateSame(ShareUtil.ZoneId, DateTime.Now.Date, 0, _pkStamina, 0, 0);
            if (code == MessageCode.Success)
            {
                //更新祝福Buff剩余场次数
                if (buffExpEntity != null && buffExpEntity.RemainTimes > 0)
                {
                    buffExpEntity.RemainTimes--;
                    NbManagerbuffpoolMgr.Update(buffExpEntity);
                }
                //记录比赛数据
                MatchCore.SaveMatchStat(pkmatchData.Home.ManagerId, EnumMatchType.PlayerKill, pkmatchData.Home.Score, pkmatchData.Away.Score, pkmatchData.Home.Score);
                //记录成就相关数据
                AchievementTaskCore.Instance.UpdatePkMatchGoals(manager.Idx, pkmatchData.Home.Score);
                TaskHandler.Instance.PkOrFriendMatchCount(manager.Idx);
                var popList = ManagerUtil.SaveManagerAfter(manager, false);
                var taskPop = TaskHandler.Instance.PlayerKillFight(manager.Idx, (int)winType);
                if (matchData.HasTask)
                {
                    //var taskPop = TaskHandler.Instance.PlayerKillFight(manager.Idx, (int)winType);
                    if (taskPop != null && taskPop.Count > 0)
                    {
                        if (popList == null)
                        {
                            popList = taskPop;
                        }
                        else
                        {
                            popList.AddRange(taskPop);
                        }
                    }
                }



                MemcachedFactory.MatchPopClient.Set(matchData.MatchId, popList);
            }
            return(code);
        }
Beispiel #8
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 #9
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);
        }