chore
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Hangfire" Version="1.8.22" />
|
||||||
<PackageReference Include="Microsoft.Orleans.Server" Version="9.2.1" />
|
<PackageReference Include="Microsoft.Orleans.Server" Version="9.2.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Hangfire;
|
||||||
using System;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Atomx.Core.Jos
|
namespace Atomx.Core.Jos
|
||||||
{
|
{
|
||||||
@@ -9,7 +7,7 @@ namespace Atomx.Core.Jos
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多语言本地化任务
|
/// 多语言本地化任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class LocalizationJob
|
public class LocalizationJob
|
||||||
{
|
{
|
||||||
readonly ILogger<LocalizationJob> _logger;
|
readonly ILogger<LocalizationJob> _logger;
|
||||||
public LocalizationJob(ILogger<LocalizationJob> logger)
|
public LocalizationJob(ILogger<LocalizationJob> logger)
|
||||||
@@ -17,10 +15,21 @@ namespace Atomx.Core.Jos
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute()
|
/// <summary>
|
||||||
|
/// 如果任务失败,重试 3 次,超过后删除任务,60 秒内不允许并发执行
|
||||||
|
/// </summary>
|
||||||
|
[AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
|
||||||
|
[DisableConcurrentExecution(60)]
|
||||||
|
public void Execute(string path)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("LocalizationJob executed at: {time}", DateTimeOffset.Now);
|
_logger.LogInformation("LocalizationJob executed at: {time}", DateTimeOffset.Now);
|
||||||
// 在这里添加多语言本地化的具体任务逻辑
|
// 在这里添加多语言本地化的具体任务逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetCache()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("LocalizationJob ResetCache executed at: {time}", DateTimeOffset.Now);
|
||||||
|
// 在这里添加重置缓存的具体逻辑
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
Atomx.Core/Jos/SendVerificationCodeJob.cs
Normal file
28
Atomx.Core/Jos/SendVerificationCodeJob.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using Atomx.Data;
|
||||||
|
using Atomx.Data.CacheServices;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Atomx.Core.Jos
|
||||||
|
{
|
||||||
|
public class SendVerificationCodeJob
|
||||||
|
{
|
||||||
|
readonly ILogger<SendVerificationCodeJob> _logger;
|
||||||
|
readonly DataContext _dbContext;
|
||||||
|
readonly ICacheService _cacheService;
|
||||||
|
public SendVerificationCodeJob(ILogger<SendVerificationCodeJob> logger, DataContext dataContext, ICacheService cacheService)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_dbContext = dataContext;
|
||||||
|
_cacheService = cacheService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(string email, string code)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("SendVerificationCodeJob executed at: {time}", DateTimeOffset.Now);
|
||||||
|
// 在这里添加发送验证码的具体任务逻辑
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using Hangfire;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -6,9 +8,25 @@ namespace Atomx.Core.Jos
|
|||||||
{
|
{
|
||||||
public partial interface IBackgroundJobsService
|
public partial interface IBackgroundJobsService
|
||||||
{
|
{
|
||||||
|
string SendSMSVerificationCode(string phoneNumber, string code, TimeSpan validDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class BackgroundJobsService : IBackgroundJobsService
|
public partial class BackgroundJobsService : IBackgroundJobsService
|
||||||
{
|
{
|
||||||
|
readonly IBackgroundJobClient _backgroundJobClient;
|
||||||
|
readonly IRecurringJobManager _recurringJobManager;
|
||||||
|
readonly ILogger<BackgroundJobsService> _logger;
|
||||||
|
public BackgroundJobsService(IBackgroundJobClient backgroundJobClient, IRecurringJobManager recurringJobManager, ILogger<BackgroundJobsService> logger)
|
||||||
|
{
|
||||||
|
_backgroundJobClient = backgroundJobClient;
|
||||||
|
_recurringJobManager = recurringJobManager;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SendSMSVerificationCode(string phoneNumber, string code, TimeSpan validDuration)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
//namespace Atomx.Data.CacheServices
|
namespace Atomx.Data.CacheServices
|
||||||
//{
|
{
|
||||||
// public partial interface ICacheService
|
public partial interface ICacheService
|
||||||
// {
|
{
|
||||||
// Task SetLocalization(string id, LocalizationModel model);
|
Task LoadLocale(string Culture);
|
||||||
|
|
||||||
// LocalizationModel GetLocalization(string id);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// public partial class CacheService : ICacheService
|
public partial class CacheService : ICacheService
|
||||||
// {
|
{
|
||||||
//public async Task SetLocalization(string id, LocalizationModel model)
|
//public async Task SetLocalization(string id, LocalizationModel model)
|
||||||
//{
|
//{
|
||||||
// var key = $"{CacheKeys.LocalizationPrefix}{id}";
|
// var key = $"{CacheKeys.LocalizationPrefix}{id}";
|
||||||
@@ -25,6 +24,6 @@
|
|||||||
// }
|
// }
|
||||||
// return cacheData;
|
// return cacheData;
|
||||||
//}
|
//}
|
||||||
// }
|
}
|
||||||
|
|
||||||
//}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user