ソースを参照

fix(auth): 干掉登录后 5 秒推送'XX好欢迎登录'的鸡肋问候消息

原代码:AuthController.login 登录成功后 schedule 5 秒后用 SseMessageUtils 推一条
'中午好,欢迎登录 RuoYi-Vue-Plus 后台管理系统' 给当前 userId

问题:每次登录/刷新 token/自动重登都 schedule 一次,会不定时重复弹 2 个
甚至多次,严重影响用户

修法:直接删掉这段 schedule + publishMessage(用户报告 PC 端右侧重复弹消息骚扰)

验证:登录后 8 秒后端日志无任何 SSE/schedule 推送
yangjingjing 1 日 前
コミット
518b8f6a27

+ 0 - 10
ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java

@@ -48,12 +48,10 @@ import org.springframework.web.bind.annotation.*;
 
 
 import java.net.URL;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.nio.charset.StandardCharsets;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
 
 
 /**
 /**
  * 认证
  * 认证
@@ -104,14 +102,6 @@ public class AuthController {
         loginService.checkTenant(loginBody.getTenantId());
         loginService.checkTenant(loginBody.getTenantId());
         // 登录
         // 登录
         LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
         LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
-
-        Long userId = LoginHelper.getUserId();
-        scheduledExecutorService.schedule(() -> {
-            SseMessageDto dto = new SseMessageDto();
-            dto.setMessage(DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统");
-            dto.setUserIds(List.of(userId));
-            SseMessageUtils.publishMessage(dto);
-        }, 5, TimeUnit.SECONDS);
         return R.ok(loginVo);
         return R.ok(loginVo);
     }
     }