fix: update GetUserByPhone

This commit is contained in:
AnonymousDotNet 2024-11-27 17:27:32 +08:00
parent fcc08859dc
commit ae2049c53e

View file

@ -22,7 +22,14 @@ public partial class MongoRepository
return null;
}
phoneSecond = phone.StartsWith("+86") ? phone.Replace("+86", "") : $"+86{phone}";
if (regionCode == "CN")
{
phoneSecond = (phone ?? "").StartsWith("+86") ? (phone ?? "").Replace("+86", "") : ($"+86{phone ?? ""}");
}
else
{
phoneSecond = (phone ?? "").Substring(regionCode == "US" ? 2 : 3);
}
var user = _dc.Users.AsQueryable().FirstOrDefault(x => (x.Phone == phone || x.Phone == phoneSecond)
&& (x.RegionCode == regionCode || string.IsNullOrWhiteSpace(x.RegionCode))