From 802401690b32532c4cd74554a076203cd73a892a Mon Sep 17 00:00:00 2001 From: AnonymousDotNet <18776095145@163.com> Date: Sat, 14 Dec 2024 10:44:35 +0800 Subject: [PATCH] fix: updated country --- .../BotSharp.Core/Users/Services/WeChatUserService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Users/Services/WeChatUserService.cs b/src/Infrastructure/BotSharp.Core/Users/Services/WeChatUserService.cs index 1da9b47e..55b8e0e9 100644 --- a/src/Infrastructure/BotSharp.Core/Users/Services/WeChatUserService.cs +++ b/src/Infrastructure/BotSharp.Core/Users/Services/WeChatUserService.cs @@ -77,7 +77,7 @@ public class WeChatUserService : IWeChatUserService // Retrieve user information var nickname = userInfo["nickname"]?.ToString() ?? string.Empty; var avatar = userInfo["headimgurl"]?.ToString() ?? string.Empty; - var country = userInfo["country"]?.ToString() ?? string.Empty; + var country = userInfo["country"]?.ToString() ?? "CN"; var province = userInfo["province"]?.ToString() ?? string.Empty; var city = userInfo["city"]?.ToString() ?? string.Empty; var sex = userInfo["sex"]?.ToString() ?? "0"; @@ -92,7 +92,7 @@ public class WeChatUserService : IWeChatUserService Sex = int.Parse(sex), Province = province, City = city, - Country = country, + Country = ((country != "CN" && country.Contains("CN")) ? "CN" : country), Headimgurl = avatar, Privilege = privilege.Split(','), UnionId = unionId @@ -105,7 +105,7 @@ public class WeChatUserService : IWeChatUserService _logger.LogError($"Create WeChatUser Error: {ex.Message}"); throw new Exception($"Failed to create WeChatUser: {ex.Message}", ex); } - + }