mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-29 08:43:24 +08:00
update 重构 common-sse 与 common-websocket 合并为 ruoyi-common-push 推送模块
This commit is contained in:
@@ -12,9 +12,12 @@ import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.dto.PushPayload;
|
||||
import org.dromara.common.core.domain.model.LoginBody;
|
||||
import org.dromara.common.core.domain.model.RegisterBody;
|
||||
import org.dromara.common.core.domain.model.SocialLoginBody;
|
||||
import org.dromara.common.core.enums.PushSourceEnum;
|
||||
import org.dromara.common.core.enums.PushTypeEnum;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.MessageUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@@ -23,12 +26,11 @@ import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.redis.annotation.RateLimiter;
|
||||
import org.dromara.common.redis.enums.LimitType;
|
||||
import org.dromara.common.push.helper.PushHelper;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
||||
import org.dromara.common.social.config.properties.SocialProperties;
|
||||
import org.dromara.common.social.utils.SocialUtils;
|
||||
import org.dromara.common.sse.dto.SseMessageDTO;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.system.domain.vo.SysClientVo;
|
||||
import org.dromara.system.service.ISysClientService;
|
||||
import org.dromara.system.service.ISysConfigService;
|
||||
@@ -93,10 +95,15 @@ public class AuthController {
|
||||
|
||||
Long userId = LoginHelper.getUserId();
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
SseMessageDTO dto = new SseMessageDTO();
|
||||
dto.setUserIds(List.of(userId));
|
||||
dto.setMessage(DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统");
|
||||
SseMessageUtils.publishMessage(dto);
|
||||
PushHelper.publishMessage(
|
||||
List.of(userId),
|
||||
PushPayload.of(
|
||||
PushTypeEnum.MESSAGE,
|
||||
PushSourceEnum.BACKEND,
|
||||
DateUtils.getTodayHour(new Date()) + "好,欢迎登录 RuoYi-Vue-Plus 后台管理系统",
|
||||
null
|
||||
)
|
||||
);
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
return R.ok(loginVo);
|
||||
}
|
||||
|
||||
@@ -213,18 +213,14 @@ management:
|
||||
logfile:
|
||||
external-file: ./logs/sys-console.log
|
||||
|
||||
--- # 默认/推荐使用sse推送
|
||||
sse:
|
||||
--- # 统一消息推送配置
|
||||
message:
|
||||
enabled: true
|
||||
path: /resource/sse
|
||||
|
||||
--- # websocket
|
||||
websocket:
|
||||
# 如果关闭 需要和前端开关一起关闭
|
||||
enabled: false
|
||||
# 路径
|
||||
path: /resource/websocket
|
||||
# 设置访问源地址
|
||||
# sse / websocket
|
||||
transport: sse
|
||||
# 统一访问路径
|
||||
path: /resource/message
|
||||
# websocket 允许的跨域来源
|
||||
allowedOrigins: '*'
|
||||
|
||||
--- # warm-flow工作流配置
|
||||
|
||||
Reference in New Issue
Block a user