正在显示
3 个修改的文件
包含
19 行增加
和
0 行删除
| @@ -10,6 +10,11 @@ import io.jsonwebtoken.Claims; | @@ -10,6 +10,11 @@ import io.jsonwebtoken.Claims; | ||
| 10 | public class Constants | 10 | public class Constants |
| 11 | { | 11 | { |
| 12 | /** | 12 | /** |
| 13 | + * UTF-8 字符集 | ||
| 14 | + */ | ||
| 15 | + public static final String UTF8 = "UTF-8"; | ||
| 16 | + | ||
| 17 | + /** | ||
| 13 | * 通用成功标识 | 18 | * 通用成功标识 |
| 14 | */ | 19 | */ |
| 15 | public static final String SUCCESS = "0"; | 20 | public static final String SUCCESS = "0"; |
| @@ -71,6 +71,18 @@ public class TokenService | @@ -71,6 +71,18 @@ public class TokenService | ||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| 74 | + * 设置用户身份信息 | ||
| 75 | + */ | ||
| 76 | + public void setLoginUser(LoginUser loginUser) | ||
| 77 | + { | ||
| 78 | + if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) | ||
| 79 | + { | ||
| 80 | + String userKey = getTokenKey(loginUser.getToken()); | ||
| 81 | + redisCache.setCacheObject(userKey, loginUser); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 74 | * 创建令牌 | 86 | * 创建令牌 |
| 75 | * | 87 | * |
| 76 | * @param loginUser 用户信息 | 88 | * @param loginUser 用户信息 |
| @@ -98,6 +98,8 @@ public class SysProfileController extends BaseController | @@ -98,6 +98,8 @@ public class SysProfileController extends BaseController | ||
| 98 | { | 98 | { |
| 99 | AjaxResult ajax = AjaxResult.success(); | 99 | AjaxResult ajax = AjaxResult.success(); |
| 100 | ajax.put("imgUrl", avatar); | 100 | ajax.put("imgUrl", avatar); |
| 101 | + loginUser.getUser().setAvatar(avatar); | ||
| 102 | + tokenService.setLoginUser(loginUser); | ||
| 101 | return ajax; | 103 | return ajax; |
| 102 | } | 104 | } |
| 103 | } | 105 | } |
-
请 注册 或 登录 后发表评论