diff --git a/Atomx.Admin/Atomx.Admin/Program.cs b/Atomx.Admin/Atomx.Admin/Program.cs index 149b5d7..c463fc6 100644 --- a/Atomx.Admin/Atomx.Admin/Program.cs +++ b/Atomx.Admin/Atomx.Admin/Program.cs @@ -15,7 +15,6 @@ using Blazored.LocalStorage; using FluentValidation; using Hangfire; using Hangfire.PostgreSql; -using Hangfire.PostgreSql.Factories; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components.Authorization; @@ -23,9 +22,7 @@ using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.ResponseCompression; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Localization; -using Npgsql; using Scalar.AspNetCore; using Serilog; using System.Globalization; diff --git a/Atomx.Core/Jos/SendVerificationCodeJob.cs b/Atomx.Core/Jos/SendVerificationCodeJob.cs index 9e79d5e..dbce1dd 100644 --- a/Atomx.Core/Jos/SendVerificationCodeJob.cs +++ b/Atomx.Core/Jos/SendVerificationCodeJob.cs @@ -1,9 +1,7 @@ using Atomx.Data; using Atomx.Data.CacheServices; +using Hangfire; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Text; namespace Atomx.Core.Jos { @@ -19,7 +17,20 @@ namespace Atomx.Core.Jos _cacheService = cacheService; } - public void Execute(string email, string code) + /// + /// 发送短信验证码任务 + /// + /// + /// + [AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)] + [DisableConcurrentExecution(60)] + public void SendSMSCode(string phone, string code) + { + _logger.LogInformation("SendVerificationCodeJob executed at: {time}", DateTimeOffset.Now); + // 在这里添加发送验证码的具体任务逻辑 + } + + public void SendEmailCode(string email, string code) { _logger.LogInformation("SendVerificationCodeJob executed at: {time}", DateTimeOffset.Now); // 在这里添加发送验证码的具体任务逻辑