/// <summary>
        /// 获取每日任务完成情况
        /// </summary>
        /// <returns></returns>
        public DailyTaskInfo GetDailyTaskStatus()
        {
            DailyTaskInfo result = new();
            BiliApiResponse <DailyTaskInfo> apiResponse = _dailyTaskApi.GetDailyTaskRewardInfo().Result;

            if (apiResponse.Code == 0)
            {
                _logger.LogDebug("请求本日任务完成状态成功");
                result = apiResponse.Data;
            }
            else
            {
                _logger.LogWarning("获取今日任务完成状态失败:{result}", apiResponse.ToJson());
                result = _dailyTaskApi.GetDailyTaskRewardInfo().Result.Data;
                //todo:偶发性请求失败,再请求一次,这么写很丑陋,待用polly再框架层面实现
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取每日任务完成情况
        /// </summary>
        /// <returns></returns>
        public DailyTaskInfo GetDailyTaskStatus()
        {
            var result      = new DailyTaskInfo();
            var apiResponse = _dailyTaskApi.GetDailyTaskRewardInfo().Result;

            if (apiResponse.Code == 0)
            {
                //_logger.LogInformation("请求本日任务完成状态成功");
                result = apiResponse.Data;
            }
            else
            {
                _logger.LogWarning("获取今日任务完成状态失败:{result}", JsonSerializer.Serialize(apiResponse));
                result = _dailyTaskApi.GetDailyTaskRewardInfo().Result.Data;
                //todo:偶发性请求失败,再请求一次,这么写很丑陋,待用polly再框架层面实现
            }

            return(result);
        }