Fix FileRepository.GetUserByPhone

This commit is contained in:
Haiping Chen 2024-11-20 05:15:21 +00:00
parent 9b77a7a43c
commit 9ad3c7ba60

View file

@ -11,9 +11,21 @@ public partial class FileRepository
return Users.FirstOrDefault(x => x.Email == email.ToLower());
}
public User? GetUserByPhone(string phone)
public User? GetUserByPhone(string phone, string? role = null, string regionCode = "CN")
{
return Users.FirstOrDefault(x => x.Phone == phone);
var query = Users.Where(x => x.Phone == phone);
if (!string.IsNullOrEmpty(role))
{
query = query.Where(x => x.Role == role);
}
if (!string.IsNullOrEmpty(regionCode))
{
query = query.Where(x => x.RegionCode == regionCode);
}
return query.FirstOrDefault();
}
public User? GetAffiliateUserByPhone(string phone)