|  | @@ -754,9 +754,9 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //获取直播点赞
 | 
	
		
			
				|  |  |          int like = 0;
 | 
	
		
			
				|  |  | +        like = syncLikeCount(roomUid);
 | 
	
		
			
				|  |  |          RBucket<Object> likeCache = redissonClient.getBucket(LIVE_ROOM_LIKE.replace(ROOM_UID, roomUid));
 | 
	
		
			
				|  |  |          if (likeCache.isExists()) {
 | 
	
		
			
				|  |  | -            like = (int) likeCache.get();
 | 
	
		
			
				|  |  |              //删除房间点赞数据
 | 
	
		
			
				|  |  |              likeCache.delete();
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -1709,6 +1709,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |              //生成主讲人信息到缓存
 | 
	
		
			
				|  |  |              SysUser sysUser = getSysUser(room.getSpeakerId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            // 判断直播间时间
 | 
	
		
			
				|  |  | +            Date endTime = DateUtil.addMinutes(new Date(), PRE_LIVE_TIME_MINUTE);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (room.getLiveStartTime().compareTo(endTime)> 0) {
 | 
	
		
			
				|  |  | +                throw new BizException("直播间时间未到");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //记录用户当前房间uid
 | 
	
		
			
				|  |  |              RLock lock = redissonClient.getLock(SPEAKER_ROOM_ING_INFO_LOCK.replace(USER_ID, room.getSpeakerId().toString()));
 | 
	
	
		
			
				|  | @@ -1968,6 +1974,9 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |          if (Objects.isNull(like)) {
 | 
	
		
			
				|  |  |              like = 0;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        like = syncLikeCount(roomVo.getRoomUid());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          roomVo.setLikeNum((int) like);
 | 
	
		
			
				|  |  |          //累计总用户数量
 | 
	
		
			
				|  |  |          // roomVo.setTotalLookNum(getNum.apply(this::getTotalUserCache, roomVo.getRoomUid()));
 | 
	
	
		
			
				|  | @@ -2466,21 +2475,27 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |       * 同步直播间点赞数
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @param roomUid 直播间uid
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional
 | 
	
		
			
				|  |  | -    public void syncLikeCount(String roomUid) {
 | 
	
		
			
				|  |  | +    public int syncLikeCount(String roomUid) {
 | 
	
		
			
				|  |  |          ImLiveBroadcastRoom room = getById(roomUid);
 | 
	
		
			
				|  |  |          if (room == null) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            return 0;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          ImLiveBroadcastRoomDetailVo imLiveBroadcastRoomDetailVo = liveBroadcastRoomDataService.getDao()
 | 
	
		
			
				|  |  |                                                                                                .queryByRoomUid(roomUid);
 | 
	
		
			
				|  |  |          if (imLiveBroadcastRoomDetailVo == null) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            return 0;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (room.getServiceProvider().equals(RongCloudLivePlugin.PLUGIN_NAME)) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            //点赞数
 | 
	
		
			
				|  |  | +            Object like = redissonClient.getBucket(LIVE_ROOM_LIKE.replace(ROOM_UID, roomUid)).get();
 | 
	
		
			
				|  |  | +            if (Objects.isNull(like)) {
 | 
	
		
			
				|  |  | +                like = 0;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return (int) like;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          LivePluginService pluginService = livePluginContext.getPluginService(room.getServiceProvider());
 | 
	
		
			
				|  |  |          List<TencentWrapper.ChatRoomGroupCounter> chatRoomGroupCounters = null;
 | 
	
	
		
			
				|  | @@ -2491,13 +2506,21 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 | 
	
		
			
				|  |  |              log.error("同步直播间点赞数失败", e);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (CollectionUtils.isEmpty(chatRoomGroupCounters)) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            return 0;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        chatRoomGroupCounters.stream().filter(a -> a.getKey().equals(EGroupDefinedDataType.LIKES.getCode()))
 | 
	
		
			
				|  |  | -            .findFirst().ifPresent(a -> {
 | 
	
		
			
				|  |  | -                                 imLiveBroadcastRoomDetailVo.setTotalLikeNum(Integer.parseInt(a.getValue()));
 | 
	
		
			
				|  |  | +        Optional<TencentWrapper.ChatRoomGroupCounter> first = chatRoomGroupCounters.stream()
 | 
	
		
			
				|  |  | +                                                                                   .filter(a -> a.getKey()
 | 
	
		
			
				|  |  | +                                                                                                 .equals(
 | 
	
		
			
				|  |  | +                                                                                                     EGroupDefinedDataType.LIKES.getCode()))
 | 
	
		
			
				|  |  | +                                                                                   .findFirst();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (first.isPresent()) {
 | 
	
		
			
				|  |  | +            int i = Integer.parseInt(first.get().getValue());
 | 
	
		
			
				|  |  | +            imLiveBroadcastRoomDetailVo.setTotalLikeNum(i);
 | 
	
		
			
				|  |  |              updateById(room);
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +            return i;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return 0;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |