Browse Source

账户更新时更新登录缓存

wangyunpeng 2 tháng trước cách đây
mục cha
commit
031d150868

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformAccountServiceImpl.java

@@ -201,6 +201,17 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
         } else {
         } else {
             account.setId(param.getId());
             account.setId(param.getId());
             accountMapper.updateByPrimaryKeySelective(account);
             accountMapper.updateByPrimaryKeySelective(account);
+            reSetToken(param.getId());
         }
         }
     }
     }
+
+    private void reSetToken(Long id) {
+        ContentPlatformAccount account = accountMapper.selectByPrimaryKey(id);
+        if (Objects.isNull(account) || !StringUtils.hasText(account.getToken())) {
+            return;
+        }
+        AccountLoginVO loginVO = new AccountLoginVO();
+        BeanUtils.copyProperties(account, loginVO);
+        saveTokenToRedis(loginVO, account.getToken(), account.getToken());
+    }
 }
 }