Commit 58e6942a authored by leiming's avatar leiming

1、对接调整

parent 2dba1935
...@@ -146,7 +146,7 @@ public class VoiceWebSocketServer { ...@@ -146,7 +146,7 @@ public class VoiceWebSocketServer {
chatgptRoleRecordsService.save(chatgptRoleRecords); chatgptRoleRecordsService.save(chatgptRoleRecords);
//如果是H5则发送给大屏消息 //如果是H5则发送给大屏消息
sendMsgToWeb(memberId,webSocketModel.getData(),session); sendMsgToWeb(memberId,webSocketModel.getData());
} else if (byId != null && "sendText".equals(webSocketModel.getAction())) { } else if (byId != null && "sendText".equals(webSocketModel.getAction())) {
ChatgptRoleRecords chatgptRoleRecords = new ChatgptRoleRecords(); ChatgptRoleRecords chatgptRoleRecords = new ChatgptRoleRecords();
chatgptRoleRecords.setMessage(webSocketModel.getData()); chatgptRoleRecords.setMessage(webSocketModel.getData());
...@@ -157,7 +157,7 @@ public class VoiceWebSocketServer { ...@@ -157,7 +157,7 @@ public class VoiceWebSocketServer {
chatgptRoleRecordsService.save(chatgptRoleRecords); chatgptRoleRecordsService.save(chatgptRoleRecords);
//如果是H5则发送给大屏消息 //如果是H5则发送给大屏消息
sendMsgToWeb(memberId,webSocketModel.getData(),session); sendMsgToWeb(memberId,webSocketModel.getData());
} }
// 文字聊天 // 文字聊天
...@@ -178,7 +178,7 @@ public class VoiceWebSocketServer { ...@@ -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("__"); String[] split = memberId.split("__");
//1.h5还是web端 //1.h5还是web端
String mark = split[0]; String mark = split[0];
...@@ -186,20 +186,22 @@ public class VoiceWebSocketServer { ...@@ -186,20 +186,22 @@ public class VoiceWebSocketServer {
String name= split[1]; String name= split[1];
if (mark.equals(WebSocketUtil.H5)){ if (mark.equals(WebSocketUtil.H5)){
Map<String, String> map1 = WebConnectUtil.getMap(); Map<String, String> map1 = WebConnectUtil.getMap();
map1.forEach((i,j)->{ List<Session> webMap = WebConnectUtil.getWebMap(name);
if (j.equals(name)){ if (!webMap.isEmpty()){
Map<String,Object> map = new HashMap<>(); webMap.forEach(i->{
map.put("action","reply");
map.put("type","text");
map.put("content",content);
String msg = JSON.toJSONString(map);
try { 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) { } catch (IOException e) {
throw new RuntimeException(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