From 04bd24b1faf7419547d1609b9eecb27fae910856 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期一, 11 八月 2025 17:33:17 +0800
Subject: [PATCH] feat:开发

---
 FlexJobApi.UserServer.Application/Auths/Commands/LoginCommandHandler.cs |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/FlexJobApi.UserServer.Application/Auths/Commands/LoginCommandHandler.cs b/FlexJobApi.UserServer.Application/Auths/Commands/LoginCommandHandler.cs
index c7b4d31..7685bd3 100644
--- a/FlexJobApi.UserServer.Application/Auths/Commands/LoginCommandHandler.cs
+++ b/FlexJobApi.UserServer.Application/Auths/Commands/LoginCommandHandler.cs
@@ -9,6 +9,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Security.Claims;
 using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
@@ -152,9 +153,15 @@
         /// <exception cref="NotImplementedException"></exception>
         public async Task<LoginCommandCallback> Handle(BindWxmpUserInfoCommand request, CancellationToken cancellationToken)
         {
-            var logier = JwtUtils.GetCurrentLogier();
+            var claims = JWTEncryption.ReadJwtToken(request.AccessToken).Claims;
+            var claimIdentity = new ClaimsIdentity("AuthenticationTypes.Federation");
+            claimIdentity.AddClaims(claims);
+            var claimsPrincipal = new ClaimsPrincipal(claimIdentity);
+            var id = claimsPrincipal.FindFirstValue("Id").ToGuid();
+            var type = claimsPrincipal.FindFirstValue("Type").ToEnum<EnumUserType>();
+
             var user = await rep.AsQueryable()
-                .Where(it => it.Type == logier.Type && it.Id == logier.Id)
+                .Where(it => it.Type == type && it.Id == id)
                 .FirstOrDefaultAsync(cancellationToken);
             if (user == null) throw Oops.Oh(EnumErrorCodeType.s404, "褰撳墠璐﹀彿");
             if (user.WxmpOpenId.IsNull()) throw Oops.Oh(EnumUserErrorCodeType.u1100);
@@ -187,11 +194,11 @@
                 }
 
                 var bindPhoneNumberUser = await rep.AsQueryable()
-                    .Where(it => it.Type == logier.Type && it.PhoneNumber == info.PhoneNumber && it.Id != user.Id)
+                    .Where(it => it.Type == type && it.PhoneNumber == info.PhoneNumber && it.Id != user.Id)
                     .FirstOrDefaultAsync(cancellationToken);
                 if (bindPhoneNumberUser == null)
                 {
-                    if (logier.Type == EnumUserType.Enterprise)
+                    if (type == EnumUserType.Enterprise)
                     {
                         throw Oops.Oh(EnumErrorCodeType.s404, "璇ヨ处鍙�");
                     }

--
Gitblit v1.9.1