mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
修改用户个人资料同步缓存信息
This commit is contained in:
parent
d49ac2e0f8
commit
5cdb4ecba5
@ -59,7 +59,18 @@ public class SysProfileController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
return toAjax(userService.updateUserProfile(user));
|
if (userService.updateUserProfile(user) > 0)
|
||||||
|
{
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
|
// 更新缓存用户信息
|
||||||
|
loginUser.getUser().setNickName(user.getNickName());
|
||||||
|
loginUser.getUser().setPhonenumber(user.getPhonenumber());
|
||||||
|
loginUser.getUser().setEmail(user.getEmail());
|
||||||
|
loginUser.getUser().setSex(user.getSex());
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,6 +109,7 @@ public class SysProfileController extends BaseController
|
|||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("imgUrl", avatar);
|
ajax.put("imgUrl", avatar);
|
||||||
|
// 更新缓存用户头像
|
||||||
loginUser.getUser().setAvatar(avatar);
|
loginUser.getUser().setAvatar(avatar);
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
return ajax;
|
return ajax;
|
||||||
|
Loading…
Reference in New Issue
Block a user