Browse Source

fix 直播考勤异常

Eric 1 năm trước cách đây
mục cha
commit
c4a5e1ea65

+ 8 - 5
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -1181,13 +1181,18 @@ public class RoomServiceImpl implements RoomService {
         // 用户退出房间多次触发调用判定
         RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
         if (Objects.isNull(roomMember)) {
-            businessLogger.warn("leaveRoomSuccess: REPEATED_EXECUTION roomId={}, userId={}, deviceNum={}", roomId, userId, deviceNum);
-            return;
+
+            // 若主播已经离开房间,先添加用户到房间
+            roomMember = saveRoomMember(roomId, userId);
+            if (Objects.isNull(roomMember) || RoleEnum.getEnumByValue(roomMember.getRole()) != RoleTeacher) {
+                businessLogger.warn("leaveRoomSuccess: REPEATED_EXECUTION roomId={}, userId={}, deviceNum={}", roomId, userId, deviceNum);
+                return;
+            }
         }
 
         // 回调整事件延迟通知
         if (callbackTs < roomMember.getJoinDt().getTime()) {
-            businessLogger.warn("leaveRoomSuccess: q roomId={}, userId={}, deviceNum={}, callbackTs={}, joinTs={}",
+            businessLogger.warn("leaveRoomSuccess: DELAY_NOTIFY roomId={}, userId={}, deviceNum={}, callbackTs={}, joinTs={}",
                     roomId, userId, deviceNum, callbackTs, roomMember.getJoinDt().getTime());
             return;
         }
@@ -1195,8 +1200,6 @@ public class RoomServiceImpl implements RoomService {
         businessLogger.info("leaveRoomSuccess: roomId={}, userId={}, deviceNum={}, joinTs={}, callbackTs={}", roomId, userId, deviceNum,
                 roomMember.getJoinDt().getTime(), callbackTs);
 
-        // 若用户已经离开房间,先添加用户到房间
-
         // 用户离开事件
         leaveRoomSuccess(roomId, userId, deviceNum);
     }