From 35289ea93e2ef5c4db8637f2260e487d907c4295 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sun, 10 Dec 2023 15:56:30 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=ED=94=84=EB=A1=9C=ED=95=84=20=ED=9B=84=EC=9B=90?= =?UTF-8?q?=EB=9E=AD=ED=82=B9=20-=20=EB=A3=B0=EB=A0=9B=20=ED=9B=84?= =?UTF-8?q?=EC=9B=90=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt index 7c1abf6..330bd33 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt @@ -69,6 +69,7 @@ class ExplorerQueryRepository( useCanCalculate.status.eq(UseCanCalculateStatus.RECEIVED) .and( useCan.canUsage.eq(CanUsage.DONATION) + .or(useCan.canUsage.eq(CanUsage.SPIN_ROULETTE)) .or(useCan.canUsage.eq(CanUsage.LIVE)) ) .and(useCan.isRefund.isFalse) @@ -107,6 +108,7 @@ class ExplorerQueryRepository( .and(useCanCalculate.recipientCreatorId.eq(creatorId)) .and( useCan.canUsage.eq(CanUsage.DONATION) + .or(useCan.canUsage.eq(CanUsage.SPIN_ROULETTE)) .or(useCan.canUsage.eq(CanUsage.LIVE)) ) ) @@ -137,6 +139,7 @@ class ExplorerQueryRepository( .and(useCanCalculate.recipientCreatorId.eq(creatorId)) .and( useCan.canUsage.eq(CanUsage.DONATION) + .or(useCan.canUsage.eq(CanUsage.SPIN_ROULETTE)) .or(useCan.canUsage.eq(CanUsage.LIVE)) ) ) -- 2.40.1 From 0c3f190044a18e72d6d043cbba285ace9cedd1a9 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sun, 10 Dec 2023 17:46:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EC=A7=80=EA=B8=88=20=EC=A6=89=EC=8B=9C=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=A7=8C=EB=93=A4=EA=B8=B0,=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EC=8B=9C=EC=9E=91=20-=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EC=8B=9C=EC=9E=91=EC=8B=9C=20?= =?UTF-8?q?=EA=B8=B0=EC=A1=B4=EC=97=90=20=EC=A7=84=ED=96=89=20=EC=A4=91?= =?UTF-8?q?=EC=9D=B8=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/live/room/LiveRoomRepository.kt | 11 +++++++++++ .../vividnext/sodalive/live/room/LiveRoomService.kt | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt index 4b4715f..b7de267 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt @@ -41,6 +41,7 @@ interface LiveRoomQueryRepository { fun getRecentRoomInfo(memberId: Long, cloudFrontHost: String): GetRecentRoomInfoResponse? fun getDonationTotal(roomId: Long): Int? fun getDonationList(roomId: Long, cloudFrontHost: String): List + fun getRoomActiveAndChannelNameIsNotNull(): List } class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : LiveRoomQueryRepository { @@ -190,6 +191,16 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L .fetch() } + override fun getRoomActiveAndChannelNameIsNotNull(): List { + return queryFactory + .selectFrom(liveRoom) + .where( + liveRoom.isActive.isTrue + .and(liveRoom.channelName.isNotNull) + ) + .fetch() + } + private fun orderByFieldAccountId( memberId: Long, status: LiveRoomStatus, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt index be21081..46577ed 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt @@ -182,6 +182,13 @@ class LiveRoomService( now } + if (now == beginDateTime) { + val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull() + for (activeRoom in activeRooms) { + activeRoom.isActive = false + } + } + if ( request.beginDateTimeString != null && beginDateTime < now.plusMinutes(30) @@ -403,6 +410,11 @@ class LiveRoomService( throw SodaException("$startAvailableDateTimeString 이후에 시작할 수 있습니다.") } + val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull() + for (activeRoom in activeRooms) { + activeRoom.isActive = false + } + val dateTime = nowDateTime .atZone(ZoneId.of("UTC")) .withZoneSameInstant(ZoneId.of(request.timezone)) -- 2.40.1