zouxuan 3 jaren geleden
bovenliggende
commit
52c6e2910b
1 gewijzigde bestanden met toevoegingen van 17 en 13 verwijderingen
  1. 17 13
      mec-im/src/main/java/com/ym/controller/RoomController.java

+ 17 - 13
mec-im/src/main/java/com/ym/controller/RoomController.java

@@ -84,19 +84,23 @@ public class RoomController{
 
     @RequestMapping(value = "/statusSync")
     public void statusSync(@RequestBody String body) throws Exception {
-        ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
-        log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
-        String roomId = notify.getChannelId();
-        String userId = notify.getUserId();
-        switch (notify.getEvent()){
-            case 11:
-                //成员加入
-                roomService.joinRoomSuccess(roomId, userId,null);
-                break;
-            case 12:
-                //成员退出
-                roomService.leaveRoomSuccess(roomId, userId,null);
-                break;
+        try {
+            ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
+            log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
+            String roomId = notify.getChannelId();
+            String userId = notify.getUserId();
+            switch (notify.getEvent()){
+                case 11:
+                    //成员加入
+                    roomService.joinRoomSuccess(roomId, userId,null);
+                    break;
+                case 12:
+                    //成员退出
+                    roomService.leaveRoomSuccess(roomId, userId,null);
+                    break;
+            }
+        }catch (Exception e){
+            log.error(e.getLocalizedMessage());
         }
     }