|
@@ -1,19 +1,10 @@
|
|
|
package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_ROOM_HEART_BEAT;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_ROOM_INFO;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_ROOM_LIKE;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_ROOM_ONLINE_USER_LIST;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_ROOM_TOTAL_USER_LIST;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_USER_LAST_CLIENT_IP;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_USER_LAST_TIME;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.LIVE_USER_ROOM;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.ROOM_UID;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.TEACHER_TEMP_LIVE_ROOM;
|
|
|
-import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.USER_ID;
|
|
|
+import static com.yonge.cooleshow.biz.dal.constant.LiveRoomConstant.*;
|
|
|
import static com.yonge.cooleshow.common.constant.SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE;
|
|
|
import static com.yonge.cooleshow.common.constant.SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE;
|
|
|
|
|
|
+import java.io.Serializable;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.ZoneId;
|
|
@@ -26,6 +17,7 @@ import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
import com.microsvc.toolkit.middleware.live.LivePluginContext;
|
|
|
import com.microsvc.toolkit.middleware.live.LivePluginService;
|
|
|
import com.microsvc.toolkit.middleware.live.impl.RongCloudLivePlugin;
|
|
@@ -36,10 +28,13 @@ import com.yonge.cooleshow.biz.dal.dto.TencentData;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.*;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.live.EAnchorStatus;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.live.EOnOffStatus;
|
|
|
+import com.yonge.cooleshow.biz.dal.mapper.ImLiveBroadcastRoomMemberMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.liveroom.ImLiveBroadcastRoomMemberWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.liveroom.LiveRoomWrapper;
|
|
|
import com.yonge.cooleshow.common.enums.EGroupDefinedDataType;
|
|
|
+import lombok.Data;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
@@ -125,6 +120,15 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
|
|
|
@Autowired
|
|
|
private LiveRoomVideoService liveRoomVideoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private LiveBroadcastRoomDataService liveBroadcastRoomDataService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ImLiveBroadcastRoomMemberMapper imLiveBroadcastRoomMemberMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ImGroupService imGroupService;
|
|
|
/**
|
|
|
* 生成房间UID
|
|
|
*
|
|
@@ -181,10 +185,13 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public RoomInfoCache speakerCheckRoomInfo(String roomUid) {
|
|
|
- Long userId = this.getSysUser().getId();
|
|
|
- LiveRoom liveRoom = this.getOne(Wrappers.<LiveRoom>lambdaQuery()
|
|
|
- .eq(LiveRoom::getRoomUid, roomUid));
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public LiveRoomWrapper.LiveRoomVo speakerCheckRoomInfo(String roomUid) {
|
|
|
+
|
|
|
+ SysUser sysUser = getSysUser();
|
|
|
+ Long userId = sysUser.getId();
|
|
|
+ LiveRoomWrapper.LiveRoomVo liveRoom = queryRoomInfo(roomUid);
|
|
|
+ LiveRoom room = getByRoomUid(roomUid);
|
|
|
if (Objects.isNull(liveRoom)) {
|
|
|
log.error("teacherCheckRoomInfo>>>live not start roomUid: {} userId:{}", roomUid, userId);
|
|
|
throw new BizException("直播还未开始!");
|
|
@@ -198,17 +205,83 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
log.error("teacherCheckRoomInfo>>>live not start roomUid: {} userId:{}", roomUid, userId);
|
|
|
throw new BizException("直播还未开始!");
|
|
|
}
|
|
|
- RoomInfoCache roomInfo = roomInfoCache.get();
|
|
|
+ Date now = new Date();
|
|
|
//校验进入房间的是否是该直播间的主讲人
|
|
|
- if (!roomInfo.getSpeakerId().equals(userId)) {
|
|
|
+ if (!liveRoom.getSpeakerId().equals(userId)) {
|
|
|
log.error("teacherCheckRoomInfo>>>not speaker roomUid: {} userId:{}", roomUid, userId);
|
|
|
throw new BizException("您不是该直播间的主讲人!");
|
|
|
}
|
|
|
- roomInfo.setLikeNum(getLike(roomUid));
|
|
|
- roomInfo.setLookNum(getNum.apply(this::getOnlineUserCache, roomUid));
|
|
|
- return roomInfo;
|
|
|
+ //获取直播间信息
|
|
|
+ RBucket<RoomSpeakerInfo> speakerCache = getRoomSpeakerInfoCache(roomUid, userId.toString());
|
|
|
+ if (!speakerCache.isExists()) {
|
|
|
+
|
|
|
+ //没有主讲人信息则生成一个
|
|
|
+ createSpeakerInfo(this.getById(liveRoom.getId()), sysUser);
|
|
|
+
|
|
|
+ // 查询主播缓存信息
|
|
|
+ speakerCache = getRoomSpeakerInfoCache(roomUid, userId.toString());
|
|
|
+ }
|
|
|
+ RoomSpeakerInfo speakerInfo = speakerCache.get();
|
|
|
+ speakerInfo.setJoinRoomTime(now);
|
|
|
+ speakerCache.set(speakerInfo);
|
|
|
+
|
|
|
+ //记录用户当前房间uid
|
|
|
+ redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, userId.toString())).set(roomUid, 12L, TimeUnit.HOURS);
|
|
|
+
|
|
|
+ // 更新直播间主播状态
|
|
|
+ lambdaUpdate()
|
|
|
+ .eq(LiveRoom::getRoomUid, roomUid)
|
|
|
+ .eq(LiveRoom::getSpeakerId, userId)
|
|
|
+ .set(LiveRoom::getSpeakerStatus, 1)
|
|
|
+ .update();
|
|
|
+
|
|
|
+ // 设置直播群组自定义数据
|
|
|
+ setGroupDefinedData(room,EGroupDefinedDataType.ANCHOR_STATUS,EAnchorStatus.ONLINE.getCode());
|
|
|
+ return liveRoom;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取房间主讲人消息
|
|
|
+ *
|
|
|
+ * @param roomUid 房间uid
|
|
|
+ * @param userId 用户id
|
|
|
+ */
|
|
|
+ private RBucket<RoomSpeakerInfo> getRoomSpeakerInfoCache(String roomUid, String userId) {
|
|
|
+ return redissonClient.getBucket(LIVE_SPEAKER_INFO.replace(USER_ID, userId).replace(ROOM_UID, roomUid));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //生成主讲人信息
|
|
|
+ private void createSpeakerInfo(LiveRoom room, SysUser sysUser) {
|
|
|
+ Date now = new Date();
|
|
|
+ RoomSpeakerInfo speakerInfo = new RoomSpeakerInfo();
|
|
|
+ speakerInfo.setSpeakerId(sysUser.getId());
|
|
|
+ speakerInfo.setSpeakerName(sysUser.getRealName());
|
|
|
+ speakerInfo.setCreateRoomTime(now);
|
|
|
+ speakerInfo.setRoomUid(room.getRoomUid());
|
|
|
+ speakerInfo.setTotalLiveTime(0);
|
|
|
+
|
|
|
+ //可以录制视频
|
|
|
+ speakerInfo.setWhetherVideo(0);
|
|
|
+ // 设置模板
|
|
|
+ speakerInfo.setVideoTemplate(1);
|
|
|
+
|
|
|
+ speakerInfo.setOs(room.getOs());
|
|
|
+ //写入主讲人信息
|
|
|
+ getRoomSpeakerInfoCache(room.getRoomUid(), room.getSpeakerId().toString()).set(speakerInfo);
|
|
|
+
|
|
|
+ //生成0点赞
|
|
|
+ redissonClient.getBucket(LIVE_ROOM_LIKE.replace(ROOM_UID, room.getRoomUid())).set(0);
|
|
|
+
|
|
|
+ //修改房间状态为开始
|
|
|
+ LiveRoom liveRoomUpdate = new LiveRoom();
|
|
|
+ liveRoomUpdate.setId(room.getId());
|
|
|
+ liveRoomUpdate.setLiveState(1);
|
|
|
+ liveRoomUpdate.setUpdatedTime(now);
|
|
|
+ liveRoomUpdate.setUpdatedBy(-2L);
|
|
|
+ liveRoomUpdate.setSpeakerStatus(1);
|
|
|
+ baseMapper.updateById(liveRoomUpdate);
|
|
|
+ }
|
|
|
/**
|
|
|
* 定时任务创建直播间
|
|
|
*/
|
|
@@ -939,25 +1012,6 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
redissonClient.getBucket(LIVE_ROOM_HEART_BEAT.replace(ROOM_UID, roomUid)).set(new Date());
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 主讲人-进入房间
|
|
|
- *
|
|
|
- * @param roomUid 房间uid
|
|
|
- */
|
|
|
- public RoomInfoCache speakerJoinRoom(String roomUid) {
|
|
|
- RoomInfoCache roomInfo = this.speakerCheckRoomInfo(roomUid);
|
|
|
-
|
|
|
- CourseSchedule schedule = getCourseScheduleByRoomUid(roomUid);
|
|
|
- Date now = new Date();
|
|
|
- roomInfo.setSpeakerState(0);
|
|
|
- roomInfo.setJoinRoomTime(now);
|
|
|
- liveBroadcastRoomMemberService.saveRecord(roomUid, roomInfo.getSpeakerId(), InOrOutEnum.IN, YesOrNoEnum.NO);
|
|
|
- //查询老师是否有进入过,没有则写老师考勤表的进入时间
|
|
|
- this.setTeacherAttendance(roomInfo.getSpeakerId(), schedule.getCourseGroupId(), schedule.getId());
|
|
|
- //记录当前用户对应的房间uid
|
|
|
- redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, roomInfo.getSpeakerId().toString())).set(roomUid, 2L, TimeUnit.DAYS);
|
|
|
- return roomInfo;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 观看者-进入房间
|
|
@@ -1689,5 +1743,291 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 进入直播间检查数据
|
|
|
+ *
|
|
|
+ * @param roomUid 房间uid
|
|
|
+ * @param userId 用户id
|
|
|
+ * @param osType 默认学生端 0:pc端 1:学生端 2:老师端
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public LiveRoomWrapper.LiveRoomVo queryRoomAndCheck(String roomUid, Long userId, int osType) {
|
|
|
+
|
|
|
+ SysUser sysUser = Optional.ofNullable(userId)
|
|
|
+ .map(this::getSysUser)
|
|
|
+ .orElseGet(this::getSysUser);
|
|
|
+
|
|
|
+ // 默认学生端查询
|
|
|
+ osType = Optional.ofNullable(osType).orElse(1);
|
|
|
+ ClientEnum clientEnum = ClientEnum.TEACHER;
|
|
|
+
|
|
|
+ // 移动端-学生端
|
|
|
+ if (osType == 1) {
|
|
|
+ clientEnum = ClientEnum.STUDENT;
|
|
|
+ //学生端
|
|
|
+ this.checkStudentRoom(roomUid, sysUser);
|
|
|
+ }
|
|
|
+ // 移动端-老师端
|
|
|
+ if (osType == 2) {
|
|
|
+ //老师端
|
|
|
+// return teacherQueryRoomAndCheck(roomUid, sysUser);
|
|
|
+ }
|
|
|
+ // PC端-直播助手
|
|
|
+ if (osType == 3) {
|
|
|
+ // 校验直播间是否存在
|
|
|
+ LiveRoomWrapper.LiveRoomVo vo = Optional.ofNullable(roomUid).map(this::queryRoomInfo)
|
|
|
+ .orElseThrow(() -> new BizException("直播间不存在"));
|
|
|
+
|
|
|
+ if (vo.getOs().equals("mobile")) {
|
|
|
+ throw new BizException("该直播间仅可在手机端直播");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.queryRoomAndCheck(queryRoomInfo(roomUid), sysUser,clientEnum);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public LiveRoomWrapper.LiveRoomVo queryRoomAndCheck(LiveRoomWrapper.LiveRoomVo room, SysUser sysUser,ClientEnum clientType) {
|
|
|
+
|
|
|
+
|
|
|
+ if (room.getLiveState() == 2) {
|
|
|
+ //如果直播结束了还是推广状态则将推广修改为取消
|
|
|
+ throw new BizException("直播已结束!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (room.getRoomState() == 1) {
|
|
|
+ throw new BizException("直播间不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ room.setBlacklistFlag(0);
|
|
|
+
|
|
|
+ LivePluginService pluginService = livePluginContext.getPluginService(room.getServiceProvider());
|
|
|
+ // 直播房间配置信息
|
|
|
+ String userSig = "";
|
|
|
+ try {
|
|
|
+ userSig = pluginService.register(imGroupService.getImUserId(sysUser.getId().toString(),clientType.getCode()), sysUser.getUsername(),
|
|
|
+ sysUser.getAvatar());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("直播房间用户注册失败: userId={}", sysUser.getId(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 直播房间统计信息
|
|
|
+ getRoomData(room);
|
|
|
+ room.setUserSig(userSig);
|
|
|
+ room.setLiveRoomConfig(pluginService.getLiveRoomConfig());
|
|
|
+
|
|
|
+ // 直播间配置信息
|
|
|
+ return room;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 直播间推流状态查询
|
|
|
+ *
|
|
|
+ * @param roomUid 直播间ID
|
|
|
+ * @return TencentWrapper.LiveStreamState
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TencentWrapper.LiveStreamState roomLiveStreamStatus(String roomUid) {
|
|
|
+
|
|
|
+ // 直播间信息
|
|
|
+ LiveRoomWrapper.LiveRoomVo roomVo = queryRoomInfo(roomUid);
|
|
|
+ if (Objects.isNull(roomVo)) {
|
|
|
+ throw new BizException("无效的直播间ID");
|
|
|
+ }
|
|
|
+
|
|
|
+ TencentWrapper.LiveStreamState liveStreamState = TencentWrapper.LiveStreamState
|
|
|
+ .builder()
|
|
|
+ .streamState("inactive")
|
|
|
+ .requestId("")
|
|
|
+ .build();
|
|
|
+ // 直播间推流状态
|
|
|
+ try {
|
|
|
+ LivePluginService pluginService = livePluginContext.getPluginService(roomVo.getServiceProvider());
|
|
|
+
|
|
|
+ liveStreamState = pluginService.liveStreamState(getStreamId(roomUid, roomVo.getSpeakerId()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("roomLiveStreamStatus roomUid={}", roomUid, e);
|
|
|
+ }
|
|
|
+
|
|
|
+ return liveStreamState;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询直播间信息
|
|
|
+ *
|
|
|
+ * @param roomUid 直播间uid
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public LiveRoomWrapper.LiveRoomVo queryRoomInfo(String roomUid) {
|
|
|
+ LiveRoom liveRoom = getByRoomUid(roomUid);
|
|
|
+ if (Objects.isNull(liveRoom)) {
|
|
|
+ throw new BizException("直播间不存在");
|
|
|
+ }
|
|
|
+ LiveRoomWrapper.LiveRoomVo liveRoomVo = JSON.parseObject(JSON.toJSONString(liveRoom), LiveRoomWrapper.LiveRoomVo.class);
|
|
|
+ return getRoomData(liveRoomVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private LiveRoomWrapper.LiveRoomVo getRoomData(LiveRoomWrapper.LiveRoomVo roomVo) {
|
|
|
+
|
|
|
+ // 同步点赞数
|
|
|
+ int likeNums = syncLikeCount(roomVo.getRoomUid());
|
|
|
+
|
|
|
+ roomVo.setLikeNum(likeNums);
|
|
|
+ roomVo.setTotalLookNum(0);
|
|
|
+ roomVo.setLookNum(0);
|
|
|
+
|
|
|
+ ImLiveBroadcastRoomMemberWrapper.RoomMemberNumDto roomMemberNumDto = imLiveBroadcastRoomMemberMapper.queryMemberNum(roomVo.getRoomUid());
|
|
|
+ if (roomMemberNumDto == null) {
|
|
|
+ roomMemberNumDto = new ImLiveBroadcastRoomMemberWrapper.RoomMemberNumDto();
|
|
|
+ roomMemberNumDto.setTotalNum(0);
|
|
|
+ roomMemberNumDto.setOnlineNum(0);
|
|
|
+ }
|
|
|
+ roomVo.setTotalLookNum(roomMemberNumDto.getTotalNum() == null? 0 : roomMemberNumDto.getTotalNum());
|
|
|
+ roomVo.setLookNum(roomMemberNumDto.getOnlineNum() == null? 0 : roomMemberNumDto.getOnlineNum());
|
|
|
+
|
|
|
+ // 直播视频数
|
|
|
+ List<LiveRoomVideo> imLiveRoomVideoVos = liveRoomVideoService.queryVideo(roomVo.getRoomUid());
|
|
|
+ if (CollectionUtils.isNotEmpty(imLiveRoomVideoVos)) {
|
|
|
+ roomVo.setVideoNum(imLiveRoomVideoVos.size());
|
|
|
+ } else {
|
|
|
+ roomVo.setVideoNum(0);
|
|
|
+ }
|
|
|
+ return roomVo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步直播间点赞数
|
|
|
+ *
|
|
|
+ * @param roomUid 直播间uid
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int syncLikeCount(String roomUid) {
|
|
|
+
|
|
|
+ // 直播间信息
|
|
|
+ LiveRoom room = getByRoomUid(roomUid);
|
|
|
+ if (room == null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 融云直播间
|
|
|
+ if (room.getServiceProvider().equals(RongCloudLivePlugin.PLUGIN_NAME)) {
|
|
|
+ //点赞数
|
|
|
+ return (int) Optional.ofNullable(redissonClient.getBucket(LIVE_ROOM_LIKE.replace(ROOM_UID, roomUid)).get()).orElse(0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 腾讯云直播
|
|
|
+ LivePluginService pluginService = livePluginContext.getPluginService(room.getServiceProvider());
|
|
|
+ List<TencentWrapper.ChatRoomGroupCounter> chatRoomGroupCounters = null;
|
|
|
+ try {
|
|
|
+ chatRoomGroupCounters = pluginService.chatRoomGroupCounterDataList(
|
|
|
+ room.getRoomUid());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("同步直播间点赞数失败", e);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(chatRoomGroupCounters)) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ 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());
|
|
|
+
|
|
|
+ LiveBroadcastRoomData one = liveBroadcastRoomDataService.lambdaQuery()
|
|
|
+ .eq(LiveBroadcastRoomData::getRoomUid, roomUid)
|
|
|
+ .last("limit 1")
|
|
|
+ .one();
|
|
|
+ // 同步点赞数
|
|
|
+ if (one != null) {
|
|
|
+ LiveBroadcastRoomData imLiveBroadcastRoomData = new LiveBroadcastRoomData();
|
|
|
+ imLiveBroadcastRoomData.setId(one.getId());
|
|
|
+ imLiveBroadcastRoomData.setLikeNum(i);
|
|
|
+ liveBroadcastRoomDataService.updateById(imLiveBroadcastRoomData);
|
|
|
+ }
|
|
|
+
|
|
|
+ return i;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询直播间在线的用户
|
|
|
+ *
|
|
|
+ * @param roomUid 直播间uid
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<LiveRoomWrapper.BaseRoomUserVo> queryRoomLimitOnlineUserInfo(String roomUid) {
|
|
|
+ RMap<Long, String> onlineUserCache = getOnlineUserCache(roomUid);
|
|
|
+ return onlineUserCache.values().parallelStream()
|
|
|
+ .map(a -> JSONObject.toJavaObject(JSONObject.parseObject(a), LiveRoomWrapper.BaseRoomUserVo.class))
|
|
|
+ .limit(200)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户连麦状态
|
|
|
+ *
|
|
|
+ * @param roomUid 直播房间id
|
|
|
+ * @param userId 用户id
|
|
|
+ * @param whetherMicStatus 连麦状态
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void userWhetherMic(String roomUid, Long userId, Integer whetherMicStatus) {
|
|
|
+ imLiveBroadcastRoomMemberMapper.userWhetherMic(roomUid, userId, whetherMicStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 主讲人信息
|
|
|
+ */
|
|
|
+ @Data
|
|
|
+ public static class RoomSpeakerInfo implements Serializable {
|
|
|
+ //主讲人id
|
|
|
+ private Long speakerId;
|
|
|
+ //主讲人名称
|
|
|
+ private String speakerName;
|
|
|
+ //直播状态 0 直播中 1关闭直播
|
|
|
+ private Integer state;
|
|
|
+ //房间uid
|
|
|
+ private String roomUid;
|
|
|
+ // 直播流sequence
|
|
|
+ private String sequence;
|
|
|
+
|
|
|
+ //房间创建时间
|
|
|
+ private Date createRoomTime;
|
|
|
+ //进入房间时间
|
|
|
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
|
+ private Date joinRoomTime;
|
|
|
+ //开始直播时间
|
|
|
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
|
+ private Date startLiveTime;
|
|
|
+ //开始直播时间
|
|
|
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
|
+ private Date endLiveTime;
|
|
|
+ //退出房间时间
|
|
|
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
|
+ private Date exitRoomTime;
|
|
|
+ //总直播时间
|
|
|
+ private Integer totalLiveTime = 0;
|
|
|
+ //是否录像 0允许 1不允许
|
|
|
+ private Integer whetherVideo;
|
|
|
+ //机构
|
|
|
+ private Integer tenantId;
|
|
|
+ //播出端- pc网页端 移动端mobile
|
|
|
+ private String os = "pc";
|
|
|
+
|
|
|
+ // 腾讯视频模板 0: 没有 1:有
|
|
|
+ private Integer videoTemplate;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|