Commit 6197ad50 authored by 若依's avatar 若依 Committed by Gitee

!330 优化 记录登录信息,移除不必要的修改

Merge pull request !330 from lihy2021/N/A
parents f8cc7ce3 b477e40d
......@@ -87,7 +87,7 @@ public class SysLoginService
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUser());
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}
......@@ -119,11 +119,15 @@ public class SysLoginService
/**
* 记录登录信息
*
* @param userId 用户ID
*/
public void recordLoginInfo(SysUser user)
public void recordLoginInfo(Long userId)
{
user.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
user.setLoginDate(DateUtils.getNowDate());
userService.updateUserProfile(user);
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
sysUser.setLoginDate(DateUtils.getNowDate());
userService.updateUserProfile(sysUser);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment