登录-更新user的lastLoginTime和ip

This commit is contained in:
khalil
2023-09-02 19:24:42 +08:00
parent 988f88ba6d
commit 139d82b50e
15 changed files with 40 additions and 47 deletions

View File

@@ -129,6 +129,7 @@ public class MyUserDetailsServiceImpl implements MyUserDetailsService {
Account account = details.getAccount();
String deviceId = deviceInfo.getDeviceId();
String client = deviceInfo.getClient();
String app = deviceInfo.getApp();
Long uid = account.getUid();
Date date = new Date();
// 拦截指定账号登录
@@ -170,9 +171,10 @@ public class MyUserDetailsServiceImpl implements MyUserDetailsService {
account.setOsversion(deviceInfo.getOsVersion());
account.setUpdateTime(date);
account.setLastLoginTime(date);
account.setLastLoginIp(ip);
accountService.updateById(account);
//更新用户正在使用的app字段
userAppService.updateCurrentApp(uid, deviceInfo.getApp());
userAppService.updateCurrentApp(uid, app, date, ip);
//将用户信息登记
AccountLoginRecord accountLoginRecord = buildAccountLoginRecord(ip, account, loginType.getValue(), deviceInfo, openId);
loginRecordService.addAccountLoginRecordAsync(accountLoginRecord);

View File

@@ -104,6 +104,7 @@ public class AccountManageService {
"用户账号异常请联系官方客服uid=" + account.getUid());
}
account.setLastLoginTime(new Date());
account.setLastLoginIp(ipAddress);
account.setUpdateTime(new Date());
accountService.updateById(account);
}
@@ -136,6 +137,7 @@ public class AccountManageService {
account = new Account();
account.setNeteaseToken(UUIDUtil.get());
account.setLastLoginTime(date);
account.setLastLoginIp(ipAddress);
account.setUpdateTime(date);
account.setRegisterIp(ipAddress);
account.setSignTime(date);
@@ -179,6 +181,7 @@ public class AccountManageService {
account.setUnionId(unionId);
}
account.setLastLoginTime(new Date());
account.setLastLoginIp(ipAddress);
account.setUpdateTime(new Date());
accountMapper.updateById(account);
}
@@ -230,6 +233,7 @@ public class AccountManageService {
}
account.setNeteaseToken(UUIDUtil.get());
account.setLastLoginTime(date);
account.setLastLoginIp(ipAddress);
account.setUpdateTime(date);
account.setRegisterIp(ipAddress);
account.setSignTime(date);