change - websocket api返回值修改

dev
Wen JY 1 year ago
parent 1f29cf95d2
commit 495289af1a

File diff suppressed because it is too large Load Diff

@ -27,9 +27,6 @@ spring:
active: dev active: dev
cloud: cloud:
nacos: nacos:
discovery:
# 服务注册地址
server-addr: localhost:8848
config: config:
# 配置中心地址 # 配置中心地址
server-addr: localhost:8848 server-addr: localhost:8848

@ -3,6 +3,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.uuid.UUID; import com.ruoyi.common.core.utils.uuid.UUID;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -29,11 +30,15 @@ public class WebSocketApi {
@PostMapping() @PostMapping()
@ResponseBody @ResponseBody
public void push(String message){ public AjaxResult push(String message){
String info = null;
try{ try{
String[] split = info.split("1");
webSocket.sendAllMessage(message); webSocket.sendAllMessage(message);
return AjaxResult.success();
}catch (Exception ex){ }catch (Exception ex){
logger.error("WebSocket Api接口异常:"+ex.getMessage()); logger.error("WebSocket Api接口异常:"+ex.getMessage());
return AjaxResult.error(ex.getMessage());
} }
} }
} }

@ -5,21 +5,21 @@ server:
# Spring # Spring
spring: spring:
application: application:
# ???? # 应用名称
name: hw-websocket name: hw-websocket
profiles: profiles:
# ???? # 环境配置
active: dev active: dev
cloud: cloud:
nacos: nacos:
discovery: discovery:
# ?????? # 服务注册地址
server-addr: localhost:8848 server-addr: localhost:8848
config: config:
# ?????? # 配置中心地址
server-addr: localhost:8848 server-addr: localhost:8848
# ?????? # 配置文件格式
file-extension: yml file-extension: yml
# ???? # 共享配置
shared-configs: shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

Loading…
Cancel
Save