/// <summary> /// 合区所需的提前发放天梯赛奖励 /// </summary> /// <returns></returns> public MessageCode ScoreToHonorJobMergeZone() { var season = CacheFactory.SeasonCache.GetCurrentSeason(); if (season == null) { return(MessageCode.LadderNoSeason); } var curDate = DateTime.Today; if (season.Idx == 1 && curDate == season.Startdate) { return(MessageCode.LadderSeasonDonotNeedSend); } int isNewSeason = 1; int curSeason = season.Idx; if (season.Startdate == curDate && season.Idx > 1) { isNewSeason = 1; curSeason = curSeason - 1; } LadderInfoMgr.ScoreToHonorMergeZone(DateTime.Today, curSeason); if (isNewSeason == 1) { try { var curSeasonEntity = CacheFactory.SeasonCache.GetEntity(curSeason); var managers = LadderManagerhistoryMgr.GetPrizeManager(curSeason); if (managers != null) { List <MailBuilder> mails = new List <MailBuilder>(managers.Count); foreach (var manager in managers) { SendPrize(manager, curSeasonEntity.Status, ref mails); if (manager.Rank < 3) { NbManagerhonorMgr.Add(manager.ManagerId, (int)EnumMatchType.Ladder, 0, manager.Season, manager.Rank); } } var mailDataTable = MailCore.BuildMailBulkTable(mails); LadderSqlHelper.SaveManagerPrize(managers, mailDataTable); } } catch (Exception ex) { SystemlogMgr.Error("ScoreToHonorJob SendPrize", ex); return(MessageCode.Exception); } } return(MessageCode.Success); }
void SendSeasonPrize(int curSeason,int seasonStatus) { var managers = CrossladderManagerhistoryMgr.GetPrizeManager(curSeason,_domainId); if (managers != null) { foreach (var manager in managers) { SendPrize(manager, EnumCrossLadderPrizeType.Season, EnumMailType.CrossLadderPrize, seasonStatus); if (manager.Rank < 3) { NbManagerhonorMgr.Add(manager.ManagerId, (int)EnumMatchType.CrossLadder, 0, manager.Season, manager.Rank,null,manager.SiteId); } } } }
public MessageCode SendPrize(DailycupInfoEntity dailycup) { if (0 == Interlocked.Exchange(ref _syncSendPrize, 1)) { try { if (dailycup == null) { return(MessageCode.DailycupNotExists); } if (dailycup.Status != (int)EnumDailycupStatus.End) //只能计算已打完的杯赛 { return(MessageCode.DailycupStatusNotEnd); } var beginRound = dailycup.Round; //获取已开奖的轮数 var endRound = DailycupCore.Instance.NowGambleOpenRound(dailycup.Round, DateTime.Now); if (beginRound > endRound) { return(MessageCode.DailycupNotimetoSendPrize); } dailycup.Status = (int)EnumDailycupStatus.StartSend; dailycup.UpdateTime = DateTime.Now; DailycupInfoMgr.Update(dailycup); var competitorsList = DailycupCompetitorsMgr.GetByDailycupId(dailycup.Idx); if (competitorsList == null) { return(MessageCode.DailycupNoCompetitors); } List <MailBuilder> mailList = new List <MailBuilder>(competitorsList.Count); List <NbManagerhonorEntity> honorList = new List <NbManagerhonorEntity>(2); foreach (var entity in competitorsList) { mailList.Add(CalPrize(entity)); ManagerCore.Instance.DeleteCache(entity.ManagerId); if (entity.Rank == -1) { honorList.Add(new NbManagerhonorEntity() { ManagerId = entity.ManagerId, MatchType = (int)EnumMatchType.Dailycup, PeriodId = entity.DailyCupId, Rank = 1, SubType = 0, Rowtime = DateTime.Now }); } else if (entity.Rank == 1) { honorList.Add(new NbManagerhonorEntity() { ManagerId = entity.ManagerId, MatchType = (int)EnumMatchType.Dailycup, PeriodId = entity.DailyCupId, Rank = 2, SubType = 0, Rowtime = DateTime.Now }); } } DailycupSqlHelper.SaveCompetitorsPrize(competitorsList); MailCore.SaveMailBulk(mailList); dailycup.Status = (int)EnumDailycupStatus.Finish; dailycup.UpdateTime = DateTime.Now; DailycupInfoMgr.Update(dailycup); foreach (var entity in honorList) { NbManagerhonorMgr.Add(entity.ManagerId, entity.MatchType, entity.SubType, entity.PeriodId, entity.Rank); } return(MessageCode.Success); } catch (Exception ex) { SystemlogMgr.Error("Dailycup SendPrize", ex); return(MessageCode.Exception); } finally { Interlocked.Exchange(ref _syncSendPrize, 0); } } else { return(MessageCode.SystemBusy); } }