Merge branch 'schedule' of http://61.169.135.146:8081/git/xymp/backend into schedule

dev
郭承 9 months ago
commit 1a482fc889

@ -25,7 +25,7 @@ public class TestController extends BaseController {
@GetMapping("sendMsg") @GetMapping("sendMsg")
@ApiOperation("发送消息") @ApiOperation("发送消息")
public void sendMsg(String msg) { public void sendMsg(String msg) {
webSocketServer.sendNotice(msg); webSocketServer.sendNotice(null, msg);
} }
@GetMapping("test") @GetMapping("test")

@ -6,4 +6,5 @@ import lombok.Data;
public class MessageModel { public class MessageModel {
int type; int type;
String content; String content;
String action;
} }

@ -46,10 +46,11 @@ public class WebSocketServer {
} }
} }
public void sendNotice(String message) { public void sendNotice(String action, String message) {
MessageModel msg = new MessageModel(); MessageModel msg = new MessageModel();
msg.setType(2); msg.setType(2);
msg.setContent(message); msg.setContent(message);
msg.setAction(action);
String json = JSONUtil.object2Json(msg); String json = JSONUtil.object2Json(msg);
Iterator<Session> it = sessionPools.listIterator(); Iterator<Session> it = sessionPools.listIterator();
while (it.hasNext()) { while (it.hasNext()) {

Loading…
Cancel
Save