示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
        }
示例#5
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);
        }