Merge branch 'Test.IRC' of http://192.168.3.69:2000/XCKJ/irc-netcore-api into Test.IRC

IRC_NewDev
hang 2023-10-12 17:23:22 +08:00
commit dfeab8793f
1 changed files with 11 additions and 3 deletions

View File

@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Caching.Memory;
using IRaCIS.Core.Application.Filter;
using DocumentFormat.OpenXml.Drawing;
using EasyCaching.Core;
namespace IRaCIS.Application.Services
{
@ -45,6 +46,7 @@ namespace IRaCIS.Application.Services
private readonly IRepository<OrganInfo> _organInfoRepository;
private readonly IRepository<TrialDocument> _trialDocumentRepository;
private readonly IRepository<User> _userRepository;
private readonly IEasyCachingProvider _provider;
private readonly IRepository<ReadingCustomTag> _readingCustomTagRepository;
private readonly IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMarkRepository;
private readonly IRepository<ReadingSystemCriterionDictionary> _readingCriterionDictionaryRepository;
@ -86,6 +88,7 @@ namespace IRaCIS.Application.Services
IRepository<OrganInfo> organInfoRepository,
IRepository<TrialDocument> trialDocumentRepository,
IRepository<User> userRepository,
IEasyCachingProvider provider,
IRepository<ReadingCustomTag> readingCustomTagRepository,
IRepository<ReadingTaskQuestionMark> readingTaskQuestionMarkRepository,
IMemoryCache cache,
@ -125,6 +128,7 @@ namespace IRaCIS.Application.Services
this._organInfoRepository = organInfoRepository;
this._trialDocumentRepository = trialDocumentRepository;
this._userRepository = userRepository;
this._provider = provider;
this._readingCustomTagRepository = readingCustomTagRepository;
this._readingTaskQuestionMarkRepository = readingTaskQuestionMarkRepository;
this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
@ -2516,10 +2520,13 @@ namespace IRaCIS.Application.Services
public async Task VerifyReadingRestTime()
{
var cacheKey = _userInfo.Id.ToString();
var value = _cache.Get(cacheKey);
var value = _provider.Get<string>(cacheKey).Value;
if (value == null)
{
_cache.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
_provider.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
// _cache.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
}
else
@ -2534,7 +2541,8 @@ namespace IRaCIS.Application.Services
else if (timespanMin > 140)
{
cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 140))) * 140);
_cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
_provider.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
// _cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
}
#endregion