| 
					
				 | 
			
			
				@@ -276,8 +276,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //1.主播没有进入房间,则直接销毁房间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (Objects.isNull(speakerInfo.getJoinRoomTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.info("roomDestroy not joinRoom >>>> cache : {}", JSONObject.toJSONString(test(room.getRoomUid(), room.getSpeakerId()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     roomDestroy(room); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    log.info("roomDestroy not joinRoom >>>> roomId:{}", room.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -288,8 +288,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         //如果退出时间大于进入时间,就将退出时间+expiredMinute分钟 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         Date exitExpiredTime = DateUtil.addMinutes(speakerInfo.getExitRoomTime(), expiredMinute); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (now.getTime() >= exitExpiredTime.getTime()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            log.info("roomDestroy exitExpiredTime >>>> cache : {}", JSONObject.toJSONString(test(room.getRoomUid(), room.getSpeakerId()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             roomDestroy(room); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            log.info("roomDestroy exitExpiredTime >>>> roomId:{}", room.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -425,40 +425,51 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 退出房间-修改用户对应的房间号信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * <p>主讲人处理进入和退出房间数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * <p>观看者只处理退出房间数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param userState 用户状态数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void quitRoom(List<ImUserState> userState) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void opsRoom(List<ImUserState> userState) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(userState)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         userState.forEach(user -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            log.info("quitRoom>>>> {}", JSONObject.toJSONString(user)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (StringUtils.isBlank(user.getStatus()) || user.getStatus().equals("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("opsRoom>>>> {}", JSONObject.toJSONString(user)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isBlank(user.getStatus())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer userId = Integer.valueOf(user.getUserid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //查询userId,如果是主讲人退出房间,那么不做后面操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //查询主讲人userId,若是主讲人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RBucket<RoomSpeakerInfo> speakerCache = redissonClient.getBucket(LIVE_SPEAKER_INFO.replace(USER_ID, user.getUserid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (speakerCache.isExists()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 RoomSpeakerInfo speakerInfo = speakerCache.get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //主讲人进入房间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (user.getStatus().equals("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    speakerInfo.setJoinRoomTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.info("opsRoom>>>> join speakerCache {}", JSONObject.toJSONString(speakerInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    speakerCache.set(speakerInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //主讲人退出房间关闭录像 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 closeLive(speakerInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 speakerInfo.setExitRoomTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                log.info("quitRoom>>>> speakerCache {}", JSONObject.toJSONString(speakerInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("opsRoom>>>> exit speakerCache {}", JSONObject.toJSONString(speakerInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 speakerCache.set(speakerInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //未查询到主讲人信息,观看者只接受退出消息 status=0 是进入房间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (user.getStatus().equals("0")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取当前用户所在房间的uid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RBucket<String> userRoom = redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, user.getUserid())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!userRoom.isExists()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String roomUid = userRoom.get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer userId = Integer.valueOf(user.getUserid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //从房间累计用户信息中查询该用户的信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RMap<Integer, RoomUserInfoVo> roomTotalUser = redissonClient.getMap(LIVE_ROOM_TOTAL_USER_LIST.replace(ROOM_UID, roomUid)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -477,10 +488,10 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     imFeignService.publishRoomMsg(message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    log.error("quitRoom>>>>  error {}", e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    log.error("quitRoom>>>>  error sendMessage {} : LOOKER_LOGIN_OUT : {}", message, JSONObject.toJSONString(userInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.error("opsRoom>>>>  looker error {}", e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.error("opsRoom>>>>  looker error sendMessage {} : LOOKER_LOGIN_OUT : {}", message, JSONObject.toJSONString(userInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                log.info("quitRoom>>>> LOOKER_LOGIN_OUT : {}", JSONObject.toJSONString(userInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("opsRoom>>>> looker LOOKER_LOGIN_OUT : {}", JSONObject.toJSONString(userInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //每次退出房间计算当前用户观看时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int minutesBetween = getMinutesBetween(userInfo.getDynamicJoinTime(), now); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -489,7 +500,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             userInfo.setLastOutTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             userInfo.setState(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             roomTotalUser.fastPut(userId, userInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            log.info("quitRoom>>>> userInfo: {}", JSONObject.toJSONString(userInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("opsRoom>>>> looker userInfo: {}", JSONObject.toJSONString(userInfo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |