优化
This commit is contained in:
@@ -31,6 +31,8 @@ public class AppMemberProfileController {
|
||||
public CommonResult<MemberUserProfileDO> getProfile() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
MemberUserProfileDO profile = memberUserProfileService.createIfAbsent(userId);
|
||||
// 更新最后登录时间
|
||||
memberUserProfileService.updateLastLoginTime(userId);
|
||||
return success(profile);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,4 +98,11 @@ public interface MemberUserProfileService {
|
||||
*/
|
||||
boolean decreaseUsedStorage(String userId, long fileSizeBytes);
|
||||
|
||||
/**
|
||||
* 更新最后登录时间
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
void updateLastLoginTime(Long userId);
|
||||
|
||||
}
|
||||
@@ -160,4 +160,15 @@ public class MemberUserProfileServiceImpl implements MemberUserProfileService {
|
||||
return affectedRows > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLastLoginTime(Long userId) {
|
||||
MemberUserProfileDO profile = memberUserProfileMapper.selectByUserId(userId);
|
||||
if (profile != null) {
|
||||
MemberUserProfileDO updateObj = new MemberUserProfileDO();
|
||||
updateObj.setId(profile.getId());
|
||||
updateObj.setLastLoginTime(LocalDateTime.now());
|
||||
memberUserProfileMapper.updateById(updateObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user