前端:
1、优化消息排序逻辑 2、新增加载历史消息 3、修复已知问题 后端: 1、优化消息排序逻辑 2、增加用户信息缓存机制 3、修改日期类型为DateTimeOffset改善时区信息丢失问题 3、修复了已知问题 数据库: 1、新增SequenceId字段用于消息排序 2、新增ClientMsgId字段用于客户端消息回执
This commit is contained in:
@@ -14,15 +14,19 @@ namespace IM_API.Services
|
||||
private readonly ImContext _context;
|
||||
private readonly ILogger<AuthService> _logger;
|
||||
private readonly IMapper _mapper;
|
||||
public AuthService(ImContext context, ILogger<AuthService> logger, IMapper mapper)
|
||||
private readonly ICacheService _cache;
|
||||
public AuthService(ImContext context, ILogger<AuthService> logger, IMapper mapper, ICacheService cache)
|
||||
{
|
||||
_context = context;
|
||||
_logger = logger;
|
||||
_mapper = mapper;
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
public async Task<User> LoginAsync(LoginRequestDto dto)
|
||||
{
|
||||
var userinfo = await _cache.GetUserCacheAsync(dto.Username);
|
||||
if (userinfo != null && userinfo.Password == dto.Password) return userinfo;
|
||||
string username = dto.Username;
|
||||
string password = dto.Password;
|
||||
var user = await _context.Users.FirstOrDefaultAsync(x => x.Username == username && x.Password == password);
|
||||
@@ -30,6 +34,7 @@ namespace IM_API.Services
|
||||
{
|
||||
throw new BaseException(CodeDefine.PASSWORD_ERROR);
|
||||
}
|
||||
await _cache.SetUserCacheAsync(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user