用户上传头像实时同步缓存,无需重新登录

duhanyu
RuoYi 5 years ago
parent cdc56a663e
commit 018195e47b

@ -9,6 +9,11 @@ import io.jsonwebtoken.Claims;
*/
public class Constants
{
/**
* UTF-8
*/
public static final String UTF8 = "UTF-8";
/**
*
*/

@ -70,6 +70,18 @@ public class TokenService
return null;
}
/**
*
*/
public void setLoginUser(LoginUser loginUser)
{
if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken()))
{
String userKey = getTokenKey(loginUser.getToken());
redisCache.setCacheObject(userKey, loginUser);
}
}
/**
*
*

@ -98,6 +98,8 @@ public class SysProfileController extends BaseController
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}

Loading…
Cancel
Save