This commit is contained in:
2026-03-07 17:29:22 +08:00
parent c2e2a64416
commit f3c2bae6bf
4 changed files with 63 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -98,4 +98,11 @@ public interface MemberUserProfileService {
*/
boolean decreaseUsedStorage(String userId, long fileSizeBytes);
/**
* 更新最后登录时间
*
* @param userId 用户ID
*/
void updateLastLoginTime(Long userId);
}

View File

@@ -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);
}
}
}