liujc 2 anni fa
parent
commit
ee1ff3e170

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/RoomTypeEnum.java

@@ -8,7 +8,7 @@ public enum RoomTypeEnum {
 
     LIVE("直播课"),
     PRACTICE("陪练课"),
-    TEMP("临时直播间");
+    LIVE_TEMP("临时直播间");
 
     private final String code;
 

+ 6 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/LiveRoomServiceImpl.java

@@ -405,7 +405,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
         Long teacherId = sysUser.getId();
         List<LiveRoom> liveRoomList = this.list(Wrappers.<LiveRoom>lambdaQuery()
                 .eq(LiveRoom::getSpeakerId, teacherId)
-                .eq(LiveRoom::getType, RoomTypeEnum.TEMP.getCode())
+                .eq(LiveRoom::getType, RoomTypeEnum.LIVE_TEMP.getCode())
                 .eq(LiveRoom::getLiveState, 1)
                 .eq(LiveRoom::getRoomState, 0)
         );
@@ -427,7 +427,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
             //如果当前时间和课程时间有交集则不能开启临时直播
             throw new BizException("当前选择的时间段有课无法开启直播");
         }
-        RoomTypeEnum en = RoomTypeEnum.TEMP;
+        RoomTypeEnum en = RoomTypeEnum.LIVE_TEMP;
         String roomUid = GenRoomUid.apply(teacherId, en);
         LiveRoom room = new LiveRoom();
         room.setRoomUid(roomUid);
@@ -480,7 +480,8 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
                 DateTime now = DateTime.now();
 
                 RTCRequest.RecordStart recordStart = RTCRequest.RecordStart.builder()
-                        .streamName(MessageFormat.format("{0}_{1}", room.getRoomUid(), room.getSpeakerId().toString()))
+                        .streamName(MessageFormat.format("{0}_{1}", room.getRoomUid(),
+                                imGroupService.getImUserId(room.getSpeakerId().toString(),ClientEnum.TEACHER.getCode())))
                         .extra("")
                         .startTime(now.toDateTime().getMillis())
                         .endTime(now.plusDays(1).toDateTime().getMillis())
@@ -1071,7 +1072,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 
         CourseSchedule schedule = getCourseScheduleByRoomUid(roomUid);
         //校验观看者是否买过课,如果是非临时直播间,则校验是否已经买过课
-        if (!roomInfo.getRoomType().equals(RoomTypeEnum.TEMP.getCode())) {
+        if (!roomInfo.getRoomType().equals(RoomTypeEnum.LIVE_TEMP.getCode())) {
             // 查询该学员成功购买课程
             CourseScheduleStudentPayment studentPayment = courseScheduleStudentPaymentService.getOne(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
                     .eq(CourseScheduleStudentPayment::getUserId, sysUser.getId())
@@ -2277,7 +2278,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
         }
         RoomSpeakerInfo roomSpeakerInfo = speakerCache.get();
         //已是直播状态则直接返回
-        if (roomSpeakerInfo.getState() ==  0) {
+        if (roomSpeakerInfo !=null && roomSpeakerInfo.getState() ==  0) {
             return;
         }