更新登录信息

Signed-off-by: 也曾为你、像超人 <1553592282@qq.com>
This commit is contained in:
也曾为你、像超人 2022-10-13 13:07:38 +00:00 committed by Gitee
parent 5029618235
commit 36e4725565
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 10 additions and 0 deletions

View File

@ -212,6 +212,11 @@ public class LoginServiceImpl implements ILoginService {
Assert.notNull(user, "账号不存在!");
Assert.isFalse(user.getIsDisable() != 0, "账号已禁用!");
// 更新登录信息
user.setLastLoginIp(IpUtil.getHostIp());
user.setLastLoginTime(System.currentTimeMillis() / 1000);
userMapper.updateById(user);
String token = ToolsUtil.makeToken();
RedisUtil.set(FrontConfig.frontendTokenKey+token, user.getId(), 7200);
@ -247,6 +252,11 @@ public class LoginServiceImpl implements ILoginService {
Assert.isFalse(!pwd.equals(user.getPassword()), "账号或密码错误!");
Assert.isFalse(user.getIsDisable() != 0, "账号已被禁用!");
// 更新登录信息
user.setLastLoginIp(IpUtil.getHostIp());
user.setLastLoginTime(System.currentTimeMillis() / 1000);
userMapper.updateById(user);
String token = ToolsUtil.makeToken();
RedisUtil.set(FrontConfig.frontendTokenKey+token, user.getId(), 7201);