瀏覽代碼

增加验证

hgw 2 年之前
父節點
當前提交
29b2217af8

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

@@ -134,6 +134,15 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
     @Override
     public RoomInfoCache speakerCheckRoomInfo(String roomUid) {
         Long userId = getSysUser().getId();
+        LiveRoom liveRoom = this.getOne(Wrappers.<LiveRoom>lambdaQuery()
+                .eq(LiveRoom::getRoomUid, roomUid));
+        if (Objects.isNull(liveRoom)) {
+            log.error("teacherCheckRoomInfo>>>live not start  roomUid: {} userId:{}", roomUid, userId);
+            throw new BizException("直播还未开始!");
+        }
+        if (liveRoom.getLiveState().equals(2)) {
+            throw new BizException("直播已结束");
+        }
         //校验房间是否存在
         RBucket<RoomInfoCache> roomInfoCache = getLiveRoomInfo(roomUid);
         if (!roomInfoCache.isExists()) {