|  | @@ -517,6 +517,37 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 同步直播间在线人数 - 3秒一次发送到直播间消息中
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void sendLiveOnlineNum() {
 | 
	
		
			
				|  |  | +        //获取所有在直播中的直播间
 | 
	
		
			
				|  |  | +        List<ImLiveBroadcastRoom> liveRooms = this.list(Wrappers.<ImLiveBroadcastRoom>lambdaQuery()
 | 
	
		
			
				|  |  | +                .eq(ImLiveBroadcastRoom::getRoomState, 0)
 | 
	
		
			
				|  |  | +                .eq(ImLiveBroadcastRoom::getLiveState, 1)
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(liveRooms)) {
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        log.info("sendLiveOnlineNum>>>> liveRooms{}", JSONObject.toJSONString(liveRooms));
 | 
	
		
			
				|  |  | +        liveRooms.forEach(room -> {
 | 
	
		
			
				|  |  | +            //发送消息到直播间
 | 
	
		
			
				|  |  | +            ImRoomMessage message = new ImRoomMessage();
 | 
	
		
			
				|  |  | +            message.setFromUserId(room.getSpeakerId().toString());
 | 
	
		
			
				|  |  | +            message.setToChatroomId(room.getRoomUid());
 | 
	
		
			
				|  |  | +            message.setObjectName(ImRoomMessage.MEMBER_COUNT);
 | 
	
		
			
				|  |  | +            message.setContent(getNum.apply(this::getOnlineUserCache, room.getRoomUid()));
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                imFeignService.publishRoomMsg(message);
 | 
	
		
			
				|  |  | +                log.info("sendLiveOnlineNum>>>> room:{}", JSONObject.toJSONString(message));
 | 
	
		
			
				|  |  | +            } catch (Exception e) {
 | 
	
		
			
				|  |  | +                log.error("sendLiveOnlineNum>>>>  error {}", e.getMessage());
 | 
	
		
			
				|  |  | +                log.error("sendLiveOnlineNum>>>>  sendMessage {} :", JSONObject.toJSONString(message));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * <p>主讲人处理进入和退出房间数据
 | 
	
		
			
				|  |  |       * <p>观看者只处理退出房间数据
 | 
	
		
			
				|  |  |       *
 |