Commit 58e6942a authored by leiming's avatar leiming

1、对接调整

parent 2dba1935
......@@ -146,7 +146,7 @@ public class VoiceWebSocketServer {
chatgptRoleRecordsService.save(chatgptRoleRecords);
//如果是H5则发送给大屏消息
sendMsgToWeb(memberId,webSocketModel.getData(),session);
sendMsgToWeb(memberId,webSocketModel.getData());
} else if (byId != null && "sendText".equals(webSocketModel.getAction())) {
ChatgptRoleRecords chatgptRoleRecords = new ChatgptRoleRecords();
chatgptRoleRecords.setMessage(webSocketModel.getData());
......@@ -157,7 +157,7 @@ public class VoiceWebSocketServer {
chatgptRoleRecordsService.save(chatgptRoleRecords);
//如果是H5则发送给大屏消息
sendMsgToWeb(memberId,webSocketModel.getData(),session);
sendMsgToWeb(memberId,webSocketModel.getData());
}
// 文字聊天
......@@ -178,7 +178,7 @@ public class VoiceWebSocketServer {
}
}
private void sendMsgToWeb(String memberId, String content,Session session) {
private void sendMsgToWeb(String memberId, String content) {
String[] split = memberId.split("__");
//1.h5还是web端
String mark = split[0];
......@@ -186,20 +186,22 @@ public class VoiceWebSocketServer {
String name= split[1];
if (mark.equals(WebSocketUtil.H5)){
Map<String, String> map1 = WebConnectUtil.getMap();
map1.forEach((i,j)->{
if (j.equals(name)){
Map<String,Object> map = new HashMap<>();
map.put("action","reply");
map.put("type","text");
map.put("content",content);
String msg = JSON.toJSONString(map);
List<Session> webMap = WebConnectUtil.getWebMap(name);
if (!webMap.isEmpty()){
webMap.forEach(i->{
try {
session.getBasicRemote().sendText(msg);
Map<String,Object> map = new HashMap<>();
// 用于标识是h5端问的,web收到收展示问的内容
map.put("action","askReply");
map.put("type","text");
map.put("content",content);
String msg = JSON.toJSONString(map);
i.getBasicRemote().sendText(msg);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
});
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment