private void GetRankListAndGivePrize() { //1.获取排行榜前150 var rankList = new List <GameRankInfoModel>(); using (var client = new GameClient()) { var rankRequest = new GetRankListBeforeDayRequest() { GameVersion = GameVersionEnum.BUMBLEBEE, DayTime = DateTime.Now }; var rankListResult = client.GetRankListBeforeDay(rankRequest); if (!rankListResult.Success) { rankListResult = client.GetRankListBeforeDay(rankRequest); if (!rankListResult.Success) { Logger.Warn($"GameGivePrizeJob => GetRankListBeforeDay 获取排行榜信息失败"); return; } } rankList = rankListResult.Result?.RankList; } if (rankList?.Count > 0) { Logger.Info($"GameGivePrizeJob => 开奖前日排行榜数据:[{rankList.Count}],{JsonConvert.SerializeObject(rankList)}"); } else { Logger.Warn($"GameGivePrizeJob => GetRankListBeforeDay 排行榜无信息"); return; } // 判断今天是否执行过:有用户领奖就是执行过 var prizeCount = DalGame.GetBumBelbeeLastDayPrizeCount(); if (prizeCount > 0) { Logger.Warn($"GameGivePrizeJob => GetRankListAndGivePrize 今日发放过奖励,prizeCount:{prizeCount}"); return; } try { //记录排行数据 var insertRankResult = DalGame.InsertGameRankList(rankList); if (!insertRankResult) { Logger.Warn($"GameGivePrizeJob => insertRankResult 记录排行榜数据失败"); } } catch (Exception ex) { Logger.Error($"GameGivePrizeJob => insertRankResult异常", ex); } //发放奖品 GivePrize(rankList); }
/// <summary> /// 获取某天之前的积分排行 /// </summary> /// <param name="request"></param> /// <returns></returns> public static async Task <OperationResult <GetRankListBeforeDayResponse> > GetRankListBeforeDayAsync(GetRankListBeforeDayRequest request) { try { var manager = GameManagerFactory.GetGameManager(request.GameVersion); if (manager == null) { // 未实现 return(OperationResult.FromError <GetRankListBeforeDayResponse>("-3", Resource.Invalid_Game_NotImpl)); } return(await manager.GetRankListBeforeDayAsync(request)); } catch (NotImplementedException e) { // 未实现 return(OperationResult.FromError <GetRankListBeforeDayResponse>("-3", Resource.Invalid_Game_NotImpl)); } }
/// <summary> /// 获取某天之前的积分排行 /// </summary> /// <param name="request"></param> /// <returns></returns> public abstract Task <OperationResult <GetRankListBeforeDayResponse> > GetRankListBeforeDayAsync(GetRankListBeforeDayRequest request);
/// <summary> /// 获取某天之前的积分排行 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <OperationResult <GetRankListBeforeDayResponse> > GetRankListBeforeDayAsync(GetRankListBeforeDayRequest request) { return(await GameManager.GetRankListBeforeDayAsync(request));; }