From 241331246e67998230933e78544f81dadab52d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Tue, 8 Oct 2024 16:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=88=E6=9D=83=E7=99=BB=E5=BD=95=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- New_College.Api/Controllers/OAuthController.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/New_College.Api/Controllers/OAuthController.cs b/New_College.Api/Controllers/OAuthController.cs index 6d5f919..caaa41f 100644 --- a/New_College.Api/Controllers/OAuthController.cs +++ b/New_College.Api/Controllers/OAuthController.cs @@ -63,7 +63,7 @@ namespace New_College.Controllers Encoding.UTF8, "application/json"));// if (userinfo != null && userinfo.code == 200 && userinfo.type == "success") { - var user = (await _CustomerInfoServices.Query(q => q.GZOpenId == userinfo.result.OpenId)).FirstOrDefault(); + var user = (await _CustomerInfoServices.Query(q => q.UUID == userinfo.result.UnionId)).FirstOrDefault();//判断移动端是否已完成unionid替换 if (user == null) { //没有用户则注册一个新用户 @@ -87,9 +87,10 @@ namespace New_College.Controllers } else { - user.UUID = userinfo.result.UnionId; + user.UUID = userinfo.result?.UnionId; + user.GZOpenId = userinfo.result?.OpenId; user.ModifyTime = DateTime.UtcNow; - if (!string.IsNullOrEmpty(userinfo.result.Mobile)&&string.IsNullOrEmpty(user.Phone)) + if (!string.IsNullOrEmpty(userinfo.result.Mobile) && string.IsNullOrEmpty(user.Phone)) { user.Phone = userinfo.result.Mobile; }