|
@@ -100,15 +100,17 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
|
|
|
|
|
|
private void saveTokenToRedis(AccountLoginVO loginInfo, String oldToken, String token) {
|
|
|
String tokenPrefix = "login.{token}";
|
|
|
- // 清除老token
|
|
|
- if (StringUtils.hasText(oldToken)) {
|
|
|
- String info = redisUtils.getString(tokenPrefix.replace("{token}", oldToken));
|
|
|
- if (StringUtils.hasText(info)) {
|
|
|
- redisUtils.del(tokenPrefix.replace("{token}", oldToken));
|
|
|
- }
|
|
|
- }
|
|
|
+// // 清除老token
|
|
|
+// if (StringUtils.hasText(oldToken)) {
|
|
|
+// String info = redisUtils.getString(tokenPrefix.replace("{token}", oldToken));
|
|
|
+// if (StringUtils.hasText(info)) {
|
|
|
+// redisUtils.del(tokenPrefix.replace("{token}", oldToken));
|
|
|
+// }
|
|
|
+// }
|
|
|
String redisKey = tokenPrefix.replace("{token}", token);
|
|
|
redisUtils.setValueWithExpire(redisKey, JSON.toJSONString(loginInfo), 7 * 24 * 60 * 60L);
|
|
|
+ String tokenListKey = "login.account.token.list." + loginInfo.getTelNum();
|
|
|
+ redisUtils.listLeftPush(tokenListKey, token);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -168,7 +170,14 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
|
|
|
account.setUpdateTimestamp(System.currentTimeMillis());
|
|
|
accountMapper.updateByPrimaryKeySelective(account);
|
|
|
// 清除token
|
|
|
- redisUtils.del("login." + account.getToken());
|
|
|
+ String tokenListKey = "login.account.token.list." + account.getTelNum();
|
|
|
+ while(true) {
|
|
|
+ String token = redisUtils.listRightPop(tokenListKey);
|
|
|
+ if (!StringUtils.hasText(token)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ redisUtils.del("login." + token);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|