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 18addd3..6f23069 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 @@ -889,6 +889,7 @@ class LiveRoomService( ?: throw SodaException("해당하는 라이브의 정보가 없습니다.") return roomInfo.donationMessageList + .filter { !it.isSecret || it.memberId == member.id!! } } fun deleteDonationMessage(request: DeleteLiveRoomDonationMessage, member: Member) { @@ -1068,14 +1069,16 @@ class LiveRoomService( container = request.container ) - if (!request.isSecret && request.message.isNotBlank()) { + if (request.message.isNotBlank()) { val lock = getOrCreateLock(memberId = member.id!!) lock.write { val roomInfo = roomInfoRepository.findByIdOrNull(room.id!!) ?: throw SodaException("해당하는 라이브의 정보가 없습니다.") roomInfo.addDonationMessage( + memberId = member.id!!, nickname = member.nickname, + isSecret = request.isSecret, can = request.can, donationMessage = request.message ) @@ -1112,14 +1115,16 @@ class LiveRoomService( container = request.container ) - if (!request.isSecret && request.message.isNotBlank()) { + if (request.message.isNotBlank()) { val lock = getOrCreateLock(memberId = member.id!!) lock.write { val roomInfo = roomInfoRepository.findByIdOrNull(room.id!!) ?: throw SodaException("해당하는 라이브의 정보가 없습니다.") roomInfo.addDonationMessage( + memberId = member.id!!, nickname = member.nickname, + isSecret = request.isSecret, can = request.can, donationMessage = request.message ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessage.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessage.kt index 52bb4a1..9088b3a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessage.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessage.kt @@ -4,7 +4,9 @@ import java.util.UUID data class LiveRoomDonationMessage( val uuid: String = UUID.randomUUID().toString(), + val memberId: Long, val nickname: String, + val isSecret: Boolean, val canMessage: String, val donationMessage: String ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/info/LiveRoomInfo.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/info/LiveRoomInfo.kt index 8d19de1..3ee0b47 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/info/LiveRoomInfo.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/info/LiveRoomInfo.kt @@ -83,11 +83,13 @@ data class LiveRoomInfo( managerCount = managerList.size } - fun addDonationMessage(nickname: String, can: Int, donationMessage: String) { + fun addDonationMessage(memberId: Long, nickname: String, isSecret: Boolean, can: Int, donationMessage: String) { val donationMessageSet = donationMessageList.toMutableSet() donationMessageSet.add( LiveRoomDonationMessage( + memberId = memberId, nickname = nickname, + isSecret = isSecret, canMessage = "${can}캔을 후원하셨습니다.", donationMessage = donationMessage ) @@ -95,11 +97,13 @@ data class LiveRoomInfo( donationMessageList = donationMessageSet.toList() } - fun addRouletteMessage(nickname: String, donationMessage: String) { + fun addRouletteMessage(memberId: Long, nickname: String, donationMessage: String) { val donationMessageSet = donationMessageList.toMutableSet() donationMessageSet.add( LiveRoomDonationMessage( + memberId = memberId, nickname = nickname, + isSecret = false, canMessage = "", donationMessage = donationMessage ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt index 7b273f4..bcd5802 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/roulette/v2/RouletteService.kt @@ -162,6 +162,7 @@ class RouletteService( ?: throw SodaException("해당하는 라이브의 정보가 없습니다.") roomInfo.addRouletteMessage( + memberId = member.id!!, nickname = member.nickname, donationMessage = "[$result] 당첨!" )