fix: Compatible +86

This commit is contained in:
AnonymousDotNet 2024-10-28 18:12:53 +08:00
parent cfac64b1cd
commit ee3a9507ca

View file

@ -13,7 +13,12 @@ public partial class MongoRepository
public User? GetUserByPhone(string phone)
{
var user = _dc.Users.AsQueryable().FirstOrDefault(x => x.Phone == phone && x.Type != UserType.Affiliate);
string phoneSecond = string.Empty;
if (phone.Substring(0, 3) != "+86")
{
phoneSecond = $"+86{phone}";
}
var user = _dc.Users.AsQueryable().FirstOrDefault(x => (x.Phone == phone || x.Phone == phoneSecond) && x.Type != UserType.Affiliate);
return user != null ? user.ToUser() : null;
}