|
@@ -145,6 +145,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
public static final String LIVE_SPEAKER_LAST_CLIENT_IP = String.join(":", "IM:LIVE_SPEAKER_LAST_CLIENT_IP", ROOM_UID, USER_ID);
|
|
|
//直播提前开始时间
|
|
|
public static final int PRE_LIVE_TIME_MINUTE = 30;
|
|
|
+ //主讲人信息
|
|
|
+ public static final String SPEAKER_ROOM_ING_INFO = String.join(":", "IM:SPEAKER_ROOM_ING_INFO", USER_ID);
|
|
|
|
|
|
/**
|
|
|
* 进入直播间检查数据
|
|
@@ -716,6 +718,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
pluginService.rtcRoomRecordStop(taskId);
|
|
|
}
|
|
|
}
|
|
|
+ redissonClient.getBucket(
|
|
|
+ SPEAKER_ROOM_ING_INFO.replace(USER_ID, room.getSpeakerId().toString())).delete();
|
|
|
|
|
|
// imFeignService.destroyLiveRoom(roomUid);
|
|
|
log.info("roomDestroy>>>> destroyLiveRoom {}", JSONObject.toJSONString(message));
|
|
@@ -1677,11 +1681,14 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
.hasEq("room_state_", 0)
|
|
|
// .hasGe("live_start_time_", now)
|
|
|
.hasLe("live_start_time_", endTime)
|
|
|
- .queryWrapper());
|
|
|
+ .queryWrapper().orderByAsc("live_start_time_"));
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return;
|
|
|
}
|
|
|
- list.forEach(this::createLiveRoom);
|
|
|
+ Collection<ImLiveBroadcastRoom> values = list.stream()
|
|
|
+ .collect(Collectors.toMap(o -> o.getSpeakerId(), o -> o, (k1, k2) -> k1))
|
|
|
+ .values();
|
|
|
+ values.forEach(this::createLiveRoom);
|
|
|
createLock.delete();
|
|
|
}
|
|
|
|
|
@@ -1694,6 +1701,16 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
//生成主讲人信息到缓存
|
|
|
SysUser sysUser = getSysUser(room.getSpeakerId());
|
|
|
|
|
|
+
|
|
|
+ //记录用户当前房间uid
|
|
|
+ RBucket<Object> bucket = redissonClient.getBucket(
|
|
|
+ SPEAKER_ROOM_ING_INFO.replace(USER_ID, room.getSpeakerId().toString()));
|
|
|
+
|
|
|
+ if (bucket.isExists()) {
|
|
|
+ log.info("createLiveRoom>>>>>>roomUid:{} is exists", bucket.get());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
//去融云创建房间
|
|
|
LivePluginService pluginService = livePluginContext.getPluginService(room.getServiceProvider());
|
|
|
|
|
@@ -1743,6 +1760,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
|
|
|
// 设置直播间房间属性默认值
|
|
|
setDefaultRoomDefinedInfo(roomVo);
|
|
|
+ bucket.set(room.getRoomUid());
|
|
|
} catch (Exception e) {
|
|
|
log.error(">>>>>>>>>> createLiveRoom error roomUid:{} msg:{}", room.getRoomUid(), e.getMessage());
|
|
|
}
|