From 26824ab5f05816687e38d062f413b95220ae7518 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期五, 22 八月 2025 10:08:04 +0800
Subject: [PATCH] fix:bug

---
 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 53f1941..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, Guid>
+    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<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
+            });
+        }
+
+        /// <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