change - websocket api接口异常处理

dev
Wen JY 1 year ago
parent 495289af1a
commit d7b20bc371

@ -2,6 +2,7 @@ package com.hw.websocket.controller;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.hw.websocket.operate.WebSocket; 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.utils.uuid.UUID;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,9 +32,12 @@ public class WebSocketApi {
@PostMapping() @PostMapping()
@ResponseBody @ResponseBody
public AjaxResult push(String message){ public AjaxResult push(String message){
String info = null;
try{ 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); webSocket.sendAllMessage(message);
return AjaxResult.success(); return AjaxResult.success();
}catch (Exception ex){ }catch (Exception ex){

Loading…
Cancel
Save