浏览代码

优化查询在线人数的返回。

lighter 4 年之前
父节点
当前提交
696e7e68fd
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/main/java/thyyxxk/wxservice_server/controller/WebSocketController.java

+ 5 - 2
src/main/java/thyyxxk/wxservice_server/controller/WebSocketController.java

@@ -3,6 +3,8 @@ package thyyxxk.wxservice_server.controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.wxservice_server.entity.ResultVo;
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
 import thyyxxk.wxservice_server.websocket.WebSocketServer;
 
 /**
@@ -15,8 +17,9 @@ import thyyxxk.wxservice_server.websocket.WebSocketServer;
 public class WebSocketController {
 
     @GetMapping("/getOnlineCount")
-    public Integer getOnlineCount() {
-        return WebSocketServer.getOnlineCount();
+    public ResultVo<String> getOnlineCount() {
+        String data = "当前在线人数:" + WebSocketServer.getOnlineCount();
+        return ResultVoUtil.success(data);
     }
 
 }