优化 记录登录信息,移除不必要的修改
This commit is contained in:
parent
f8cc7ce328
commit
b477e40d3c
|
@ -87,7 +87,7 @@ public class SysLoginService
|
||||||
}
|
}
|
||||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||||
recordLoginInfo(loginUser.getUser());
|
recordLoginInfo(loginUser.getUserId());
|
||||||
// 生成token
|
// 生成token
|
||||||
return tokenService.createToken(loginUser);
|
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()));
|
SysUser sysUser = new SysUser();
|
||||||
user.setLoginDate(DateUtils.getNowDate());
|
sysUser.setUserId(userId);
|
||||||
userService.updateUserProfile(user);
|
sysUser.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||||
|
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||||
|
userService.updateUserProfile(sysUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue