|
@@ -442,7 +442,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
RoomSpeakerInfo speakerInfo = speakerCache.get();
|
|
|
//校验房间心跳是否过期没续租
|
|
|
RBucket<Date> lastRoomHeartbeatCache = redissonClient.getBucket(LIVE_ROOM_SPEAKER_HEART_BEAT.replace(ROOM_UID, room.getRoomUid()));
|
|
|
- if(lastRoomHeartbeatCache.isExists()){
|
|
|
+ if (lastRoomHeartbeatCache.isExists()) {
|
|
|
//获取最后一次房间心跳时间
|
|
|
Date lastDate = lastRoomHeartbeatCache.get();
|
|
|
//房间心跳过期时间 = 将房间心跳时间+过期分钟
|
|
@@ -1114,6 +1114,26 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
public Map<String, Object> test(String roomUid) {
|
|
|
//test
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
+ //校验房间心跳是否过期没续租
|
|
|
+ RBucket<Date> lastRoomHeartbeatCache = redissonClient.getBucket(LIVE_ROOM_SPEAKER_HEART_BEAT.replace(ROOM_UID, roomUid));
|
|
|
+ if (lastRoomHeartbeatCache.isExists()) {
|
|
|
+ result.put("房间心跳", DateUtil.dateToString(lastRoomHeartbeatCache.get(), DateUtil.EXPANDED_DATE_TIME_FORMAT));
|
|
|
+ } else {
|
|
|
+ result.put("房间心跳", "房间心跳不存在");
|
|
|
+ }
|
|
|
+ String userId = "";
|
|
|
+ try {
|
|
|
+ String[] split = roomUid.split("-");
|
|
|
+ userId = split[1];
|
|
|
+ } catch (Exception ignored) {
|
|
|
+ }
|
|
|
+ //获取主讲人信息
|
|
|
+ RBucket<RoomSpeakerInfo> speakerCache = redissonClient.getBucket(LIVE_SPEAKER_INFO.replace(USER_ID, userId));
|
|
|
+ if (speakerCache.isExists()) {
|
|
|
+ result.put("主讲人信息", speakerCache.get());
|
|
|
+ } else {
|
|
|
+ result.put("主讲人信息", "主讲人信息不存在");
|
|
|
+ }
|
|
|
//点赞数
|
|
|
Object like = redissonClient.getBucket(LIVE_ROOM_LIKE.replace(ROOM_UID, roomUid)).get();
|
|
|
if (Objects.isNull(like)) {
|
|
@@ -1139,20 +1159,6 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
} else {
|
|
|
result.put("总人员数据", "没有人员数据");
|
|
|
}
|
|
|
- String userId = "";
|
|
|
- try {
|
|
|
- String[] split = roomUid.split("-");
|
|
|
- userId = split[1];
|
|
|
- } catch (Exception ignored) {
|
|
|
- }
|
|
|
-
|
|
|
- //获取主讲人信息
|
|
|
- RBucket<RoomSpeakerInfo> speakerCache = redissonClient.getBucket(LIVE_SPEAKER_INFO.replace(USER_ID, userId));
|
|
|
- if (speakerCache.isExists()) {
|
|
|
- result.put("主讲人信息", speakerCache.get());
|
|
|
- } else {
|
|
|
- result.put("主讲人信息", "主讲人信息不存在");
|
|
|
- }
|
|
|
result.put("总观看人数", totalLook);
|
|
|
result.put("实时观看数", look);
|
|
|
return result;
|