记录用户登录IP地址和登录时间

This commit is contained in:
RuoYi
2024-07-09 12:06:40 +08:00
parent fcff9dfdea
commit 0953a9c0b2
7 changed files with 48 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ public class SysProfileController extends BaseController
{
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
}
if (userService.updateUserProfile(currentUser) > 0)
if (userService.updateUserProfile(currentUser))
{
// 更新缓存用户信息
tokenService.setLoginUser(loginUser);

View File

@@ -149,6 +149,15 @@ public class SysUserController extends BaseController
return R.ok(userService.registerUser(sysUser));
}
/**
*记录用户登录IP地址和登录时间
*/
@PutMapping("/recordlogin")
public R<Boolean> recordlogin(@RequestBody SysUser sysUser)
{
return R.ok(userService.updateUserProfile(sysUser));
}
/**
* 获取用户信息
*

View File

@@ -150,7 +150,7 @@ public interface ISysUserService
* @param user 用户信息
* @return 结果
*/
public int updateUserProfile(SysUser user);
public boolean updateUserProfile(SysUser user);
/**
* 修改用户头像

View File

@@ -336,9 +336,9 @@ public class SysUserServiceImpl implements ISysUserService
* @return 结果
*/
@Override
public int updateUserProfile(SysUser user)
public boolean updateUserProfile(SysUser user)
{
return userMapper.updateUser(user);
return userMapper.updateUser(user) > 0;
}
/**