|
@@ -95,7 +95,7 @@ public class WebSocketServer {
|
|
|
this.session = session;
|
|
|
//如果存在就先删除一个,防止重复推送消息
|
|
|
for (WebSocketServer webSocket : webSocketSet) {
|
|
|
- if (webSocket.sid.equals(userId)) {
|
|
|
+ if (webSocket.sid.equals(String.valueOf(userId))) {
|
|
|
webSocketSet.remove(webSocket);
|
|
|
count.getAndDecrement();
|
|
|
}
|
|
@@ -249,7 +249,7 @@ public class WebSocketServer {
|
|
|
Long receiveUserId = jsonObject.getLong("receiveUserId");
|
|
|
String type = jsonObject.getString("type"); //消息分类 chat
|
|
|
int messageType = jsonObject.getInteger("messageType"); //消息类型
|
|
|
- JSONObject sendText = jsonObject.getJSONObject("sendText");
|
|
|
+// JSONObject sendText = jsonObject.getJSONObject("sendText");
|
|
|
CommunityChatMsg chatMsg = null;
|
|
|
if (type.equals(MessageType.CHAT.getType())) {
|
|
|
LOGGER.debug("聊天消息推送");
|
|
@@ -265,31 +265,31 @@ public class WebSocketServer {
|
|
|
switch (messageType) {
|
|
|
case 0:
|
|
|
//文字
|
|
|
- String context = sendText.getString("context");
|
|
|
+ String context = jsonObject.getString("context");
|
|
|
//存储历史消息
|
|
|
chatMsg.setContent(context);
|
|
|
break;
|
|
|
case 1:
|
|
|
//图片
|
|
|
- chatMsg.setFileUrl(sendText.getString("fileUrl"));
|
|
|
+ chatMsg.setFileUrl(jsonObject.getString("fileUrl"));
|
|
|
break;
|
|
|
case 2:
|
|
|
//语音
|
|
|
- chatMsg.setFileUrl(sendText.getString("fileUrl"));
|
|
|
- chatMsg.setTime(sendText.getInteger("time"));
|
|
|
+ chatMsg.setFileUrl(jsonObject.getString("fileUrl"));
|
|
|
+ chatMsg.setTime(jsonObject.getInteger("time"));
|
|
|
break;
|
|
|
case 3:
|
|
|
//定位
|
|
|
- String address = sendText.getString("address");
|
|
|
- Double latitude = sendText.getDouble("latitude"); //纬度
|
|
|
- Double longitude = sendText.getDouble("longitude"); //经度
|
|
|
+ String address = jsonObject.getString("address");
|
|
|
+ Double latitude = jsonObject.getDouble("latitude"); //纬度
|
|
|
+ Double longitude = jsonObject.getDouble("longitude"); //经度
|
|
|
chatMsg.setAddress(address);
|
|
|
chatMsg.setLatitude(latitude);
|
|
|
chatMsg.setLongitude(longitude);
|
|
|
break;
|
|
|
case 4:
|
|
|
//视频
|
|
|
- chatMsg.setFileUrl(sendText.getString("fileUrl"));
|
|
|
+ chatMsg.setFileUrl(jsonObject.getString("fileUrl"));
|
|
|
break;
|
|
|
|
|
|
}
|