From 53ee0a68605433db362abae3ed1af03fd23a7832 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期五, 08 八月 2025 15:57:33 +0800 Subject: [PATCH] pref:优化 --- FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-) diff --git a/FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs b/FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs index 53f1941..4831a8d 100644 --- a/FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs +++ b/FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs @@ -1,4 +1,5 @@ 锘縰sing FlexJobApi.Core; +using Furion.DatabaseAccessor; using Mapster; using MediatR; using System; @@ -12,28 +13,26 @@ /// <summary> /// 楠岃瘉鐮佸懡浠ゅ鐞嗗櫒 /// </summary> - public class VerifyCodeCommandHandler - : IRequestHandler<SendVerifyCodeCommand, Guid> + public class VerifyCodeCommandHandler( + SmsUtils smsUtils + ) + : IRequestHandler<SendLoginOrRegisterVerifyCodeCommand, Guid> { + private readonly SmsUtils smsUtils = smsUtils; + /// <summary> - /// 鍙戦�侀獙璇佺爜 + /// 鍙戦�佺櫥褰曟垨娉ㄥ唽鐭俊 /// </summary> /// <param name="request"></param> /// <param name="cancellationToken"></param> /// <returns></returns> - public Task<Guid> Handle(SendVerifyCodeCommand request, CancellationToken cancellationToken) + public Task<Guid> Handle(SendLoginOrRegisterVerifyCodeCommand request, CancellationToken cancellationToken) { - throw new Exception(); - //var callback = new FriendlyEmptyCallback(); - //var code = new Random().Next(100000, 999999).ToString(); - //var entity = new SmsLog(); - //request.Adapt(entity); - //entity.Expiry = DateTime.Now.AddMinutes(30); - //entity.TemplateParam = new { code }.ToJson(); - //await utils.SendAsync(request.PhoneNumber, request.TemplateCode, entity.TemplateParam, cancellationToken); - //rep.Add(entity); - //await rep.SaveChangesAsync(cancellationToken); - //return new FriendlyEmptyCallback("楠岃瘉鐮佸凡鍙戦�侊紝璇锋煡鏀�"); + return smsUtils.SendVerifyCode(new SendVerifyCodeModel + { + PhoneNumber = request.PhoneNumber, + TemplateCode = EnumSmsTemplateCode.LoginOrRegister + }); } } } -- Gitblit v1.9.1