update 优化 sse 登录校验 避免大量报错

This commit is contained in:
疯狂的狮子Li
2025-07-07 15:46:07 +08:00
parent 28daad748d
commit 999203665a

View File

@@ -29,7 +29,9 @@ public class SseController implements DisposableBean {
*/
@GetMapping(value = "${sse.path}", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public SseEmitter connect() {
StpUtil.checkLogin();
if (!StpUtil.isLogin()) {
return null;
}
String tokenValue = StpUtil.getTokenValue();
Long userId = LoginHelper.getUserId();
return sseEmitterManager.connect(userId, tokenValue);