105040 Add 用户登录后缓存
This commit is contained in:
parent
8931360620
commit
e36444b9b8
|
|
@ -1,5 +1,6 @@
|
|||
using LFlow.Base.Interfaces;
|
||||
using LFlow.Base.Utils;
|
||||
using LFlow.Cache.Interface;
|
||||
using LFlow.UserManagement.Model;
|
||||
using LFlow.UserManagement.Util;
|
||||
|
||||
|
|
@ -8,7 +9,7 @@ namespace LFlow.UserManagement.Service
|
|||
/// <summary>
|
||||
/// 在线管理服务
|
||||
/// </summary>
|
||||
public class UserManagementService(IRepo<UserModel, string> repo) : IUserManagementService
|
||||
public class UserManagementService(IRepo<UserModel, string> repo, ISelfCache cacher) : IUserManagementService
|
||||
{
|
||||
public UserDto? Login(UserDto user)
|
||||
{
|
||||
|
|
@ -26,6 +27,7 @@ namespace LFlow.UserManagement.Service
|
|||
}
|
||||
var loginedUser = repo.Get(userModel.FirstOrDefault());
|
||||
loginedUser.UserPassword = "";
|
||||
cacher.SetAsync(loginedUser.ID, loginedUser, TimeSpan.FromHours(2));
|
||||
return loginedUser.MapTo<UserDto>();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue