!24 更新登录信息

Merge pull request !24 from 也曾为你、像超人/N/A
This commit is contained in:
Ants 2022-10-14 01:58:27 +00:00 committed by Gitee
commit 6efc39f902
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);