hdong:fix default source.

This commit is contained in:
YouWeiDH 2025-01-21 20:25:23 +08:00
parent 43eaf46d79
commit 9ea04ecd78
3 changed files with 5 additions and 5 deletions

View file

@ -27,7 +27,7 @@ public interface IBotSharpRepository : IHaveServiceProvider
#region User
User? GetUserByEmail(string email) => throw new NotImplementedException();
User? GetUserByPhone(string phone, string type = UserType.Client, string regionCode = "CN") => throw new NotImplementedException();
User? GetUserByPhone(string phone, string source = "internal", string regionCode = "CN") => throw new NotImplementedException();
User? GetAffiliateUserByPhone(string phone) => throw new NotImplementedException();
User? GetUserById(string id) => throw new NotImplementedException();
List<User> GetUserByIds(List<string> ids) => throw new NotImplementedException();

View file

@ -11,13 +11,13 @@ public partial class FileRepository
return Users.FirstOrDefault(x => x.Email == email.ToLower());
}
public User? GetUserByPhone(string phone, string? type = UserType.Client, string regionCode = "CN")
public User? GetUserByPhone(string phone, string? source = UserType.Internal, string regionCode = "CN")
{
var query = Users.Where(x => x.Phone == phone);
if (!string.IsNullOrEmpty(type))
if (!string.IsNullOrEmpty(source))
{
query = query.Where(x => x.Type == type);
query = query.Where(x => x.Type == source);
}
if (!string.IsNullOrEmpty(regionCode))

View file

@ -178,7 +178,7 @@ public class UserService : IUserService
var base64 = Encoding.UTF8.GetString(Convert.FromBase64String(authorization));
var (id, password, regionCode) = base64.SplitAsTuple(":");
var db = _services.GetRequiredService<IBotSharpRepository>();
var record = db.GetUserByPhone(id, type: UserType.Internal);
var record = db.GetUserByPhone(id, source: UserType.Internal);
var isCanLogin = record != null && !record.IsDisabled
&& record.Type == UserType.Internal && new List<string>
{