This commit is contained in:
张良(004796)
2024-02-04 15:51:11 +08:00
parent 405660082d
commit d946b45ab1
13 changed files with 121 additions and 30 deletions

View File

@@ -217,21 +217,6 @@ public class CaiLoginManager {
}
public void recordLoginInfo(User user, String ip,String imei) {
String address = AddressUtils.getRealAddressByIP(ip);
UserInfo userInfo = userInfoService.getById(user.getId());
UserInfo update = new UserInfo();
update.setUserId(user.getId());
update.setLoginCount(userInfo.getLoginCount()==null?0:userInfo.getLoginCount()+1);
update.setLastLoginIp(ip);
update.setLastLoginTime(LocalDateTime.now());
update.setLastLocation(address);
if(StringUtils.isNotBlank(imei)){
update.setImei(imei);
}
userInfoService.updateById(update);
}
/**
* 退出登录
@@ -262,9 +247,6 @@ public class CaiLoginManager {
loginUser.setUserType(UserType.APP_USER.getUserType());
LoginHelper.login(loginUser);
sysLoginService.recordLogininfor(loginUser.getUsername(), UserType.APP_USER.getUserType(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
String clientIP = ServletUtils.getClientIP();
String imei = ServletUtils.getImei();
ExecutorConstant.COMMON_EXECUTOR.execute(() -> recordLoginInfo(user,clientIP,imei));
return StpUtil.getTokenValue();
}