|
@@ -36,6 +36,7 @@ import com.yonge.cooleshow.biz.dal.redisson.RedissonMessageService;
|
|
|
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.constant.SysConfigConstant;
|
|
|
import com.yonge.cooleshow.common.enums.EGroupDefinedDataType;
|
|
|
import com.yonge.toolset.payment.util.DistributedLock;
|
|
|
import lombok.Data;
|
|
@@ -222,33 +223,37 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
log.error("teacherCheckRoomInfo>>>not speaker roomUid: {} userId:{}", roomUid, userId);
|
|
|
throw new BizException("您不是该直播间的主讲人!");
|
|
|
}
|
|
|
+ speakCache(room, userId);
|
|
|
+ return liveRoom;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void speakCache(LiveRoom room, Long userId) {
|
|
|
//获取直播间信息
|
|
|
- RBucket<RoomSpeakerInfo> speakerCache = getRoomSpeakerInfoCache(roomUid, userId.toString());
|
|
|
+ RBucket<RoomSpeakerInfo> speakerCache = getRoomSpeakerInfoCache(room.getRoomUid(), userId.toString());
|
|
|
if (!speakerCache.isExists()) {
|
|
|
|
|
|
//没有主讲人信息则生成一个
|
|
|
- createSpeakerInfo(this.getById(liveRoom.getId()), sysUser);
|
|
|
+ createSpeakerInfo(this.getById(room.getId()), userId);
|
|
|
|
|
|
// 查询主播缓存信息
|
|
|
- speakerCache = getRoomSpeakerInfoCache(roomUid, userId.toString());
|
|
|
+ speakerCache = getRoomSpeakerInfoCache(room.getRoomUid(), userId.toString());
|
|
|
}
|
|
|
RoomSpeakerInfo speakerInfo = speakerCache.get();
|
|
|
- speakerInfo.setJoinRoomTime(now);
|
|
|
+ speakerInfo.setJoinRoomTime(new Date());
|
|
|
speakerCache.set(speakerInfo);
|
|
|
|
|
|
//记录用户当前房间uid
|
|
|
- redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, userId.toString())).set(roomUid, 12L, TimeUnit.HOURS);
|
|
|
+ redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, userId.toString())).set(room.getRoomUid(), 12L, TimeUnit.HOURS);
|
|
|
|
|
|
// 更新直播间主播状态
|
|
|
lambdaUpdate()
|
|
|
- .eq(LiveRoom::getRoomUid, roomUid)
|
|
|
+ .eq(LiveRoom::getRoomUid, room.getRoomUid())
|
|
|
.eq(LiveRoom::getSpeakerId, userId)
|
|
|
.set(LiveRoom::getSpeakerStatus, 1)
|
|
|
.update();
|
|
|
|
|
|
// 设置直播群组自定义数据
|
|
|
setGroupDefinedData(room,EGroupDefinedDataType.ANCHOR_STATUS,EAnchorStatus.ONLINE.getCode());
|
|
|
- return liveRoom;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -263,7 +268,10 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
|
|
|
|
|
|
//生成主讲人信息
|
|
|
- private void createSpeakerInfo(LiveRoom room, SysUser sysUser) {
|
|
|
+ private void createSpeakerInfo(LiveRoom room, Long userId) {
|
|
|
+
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(userId);
|
|
|
+
|
|
|
Date now = new Date();
|
|
|
RoomSpeakerInfo speakerInfo = new RoomSpeakerInfo();
|
|
|
speakerInfo.setSpeakerId(sysUser.getId());
|
|
@@ -376,6 +384,13 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
|
|
|
this.createLiveRoomInfo(room);
|
|
|
//开课提醒
|
|
|
this.pushLiveCreateRoom(room);
|
|
|
+
|
|
|
+ // 如果是同时在管乐迷和酷乐秀直播的老师
|
|
|
+
|
|
|
+ String teacherIds = sysConfigService.findConfigValue(SysConfigConstant.LIVE_TEACHER_IDS);
|
|
|
+ if (StringUtils.isNotBlank(teacherIds) && Arrays.asList(teacherIds.split(",")).contains(room.getSpeakerId().toString())) {
|
|
|
+ speakCache(room, room.getSpeakerId());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|