浏览代码

直播课进入房间时,判断直播课是否已经完成

liujc 1 年之前
父节点
当前提交
2a79946541

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

@@ -2201,6 +2201,15 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
         Optional.ofNullable(roomUid).orElseThrow(() -> new BizException("房间编号不能为空!"));
         Optional.ofNullable(userId).orElseThrow(() -> new BizException("人员编号不能为空!"));
 
+        // 如果是直播课程,判断是否已经结束
+        Integer count = courseScheduleService.lambdaQuery()
+                .eq(CourseSchedule::getRoomUid, roomUid)
+                .eq(CourseSchedule::getStatus, "COMPLETE")
+                .count();
+        if (count >0 ) {
+            throw new BizException("直播课已结束");
+        }
+
         // 设置进入时间
         RBucket<Long> userStateTimeCache = redissonClient.getBucket(LIVE_USER_LAST_TIME.replace(USER_ID, userId.toString()));
         long time = DateTime.now().plusSeconds(1).getMillis();