From d7b20bc37100cd7c3753952e97a3cf9c729015dd Mon Sep 17 00:00:00 2001 From: Wen JY Date: Fri, 15 Sep 2023 14:08:15 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20websocket=20api=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hw/websocket/controller/WebSocketApi.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java index d36358b..45818b7 100644 --- a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java +++ b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java @@ -2,6 +2,7 @@ package com.hw.websocket.controller; import com.alibaba.fastjson2.JSONObject; import com.hw.websocket.operate.WebSocket; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.uuid.UUID; import com.ruoyi.common.core.web.domain.AjaxResult; import org.slf4j.Logger; @@ -31,9 +32,12 @@ public class WebSocketApi { @PostMapping() @ResponseBody public AjaxResult push(String message){ - String info = null; try{ - String[] split = info.split("1"); + if(StringUtils.isEmpty(message)){ + logger.info("WebSocket Api接收数据为空"); + return AjaxResult.error("参数不允许为空"); + } + logger.info("WebSocket Api接收数据:"+message); webSocket.sendAllMessage(message); return AjaxResult.success(); }catch (Exception ex){