From ab92e760e8461f0a48b37786b0f5a78db744dca6 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期一, 18 八月 2025 16:37:06 +0800
Subject: [PATCH] feat:开发

---
 FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs |   45 ++++++++++++++++++++++++++++++---------------
 1 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs b/FlexJobApi.UserServer.Application/Auths/Commands/VerifyCodeCommandHandler.cs
index 00c5761..e9a5d26 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,42 @@
     /// <summary>
     /// 楠岃瘉鐮佸懡浠ゅ鐞嗗櫒
     /// </summary>
-    public class VerifyCodeCommandHandler
-        : IRequestHandler<SendVerifyCodeCommand>
+    public class VerifyCodeCommandHandler(
+            SmsUtils smsUtils
+        ) : 
+        IRequestHandler<SendLoginOrRegisterVerifyCodeCommand, Guid>,
+        IRequestHandler<UpdatePhoneNumberVerifyCodeCommand, Guid>
     {
+        private readonly SmsUtils smsUtils = smsUtils;
+
         /// <summary>
-        /// 鍙戦�侀獙璇佺爜
+        /// 鍙戦�佺櫥褰曟垨娉ㄥ唽鐭俊
         /// </summary>
         /// <param name="request"></param>
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
-        public Task 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
+            });
+        }
+
+        /// <summary>
+        /// 鍙戦�佹洿鎹㈡墜鏈哄彿鐭俊
+        /// </summary>
+        /// <param name="request"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        public Task<Guid> Handle(UpdatePhoneNumberVerifyCodeCommand request, CancellationToken cancellationToken)
+        {
+            return smsUtils.SendVerifyCode(new SendVerifyCodeModel
+            {
+                PhoneNumber = request.PhoneNumber,
+                TemplateCode = EnumSmsTemplateCode.UpdateUserPhoneNumber
+            });
         }
     }
 }

--
Gitblit v1.9.1