Compare commits
No commits in common. "cc695c115bf41c69da08709e67047ab764d90b98" and "c46d6621ecdbdbe05f86ecb721f4edd7a20541a4" have entirely different histories.
cc695c115b
...
c46d6621ec
|
@ -170,14 +170,6 @@ class AudioContentService(
|
|||
|
||||
if (request.price in 1..4) throw SodaException("콘텐츠의 최소금액은 5캔 입니다.")
|
||||
|
||||
val isOnlyRental = if (request.limited != null && request.limited > 0) {
|
||||
false
|
||||
} else if (request.purchaseOption == PurchaseOption.RENT_ONLY) {
|
||||
true
|
||||
} else {
|
||||
request.isOnlyRental
|
||||
}
|
||||
|
||||
// DB에 값 추가
|
||||
val audioContent = AudioContent(
|
||||
title = request.title,
|
||||
|
@ -193,7 +185,7 @@ class AudioContentService(
|
|||
isAdult = request.isAdult,
|
||||
purchaseOption = request.purchaseOption,
|
||||
isGeneratePreview = request.isGeneratePreview,
|
||||
isOnlyRental = isOnlyRental,
|
||||
isOnlyRental = if (request.limited != null && request.limited > 0) false else request.isOnlyRental,
|
||||
isCommentAvailable = request.isCommentAvailable
|
||||
)
|
||||
audioContent.theme = theme
|
||||
|
|
|
@ -5,7 +5,6 @@ import kr.co.vividnext.sodalive.can.use.CanUsage
|
|||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.content.AudioContent
|
||||
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
||||
import kr.co.vividnext.sodalive.content.PurchaseOption
|
||||
import kr.co.vividnext.sodalive.content.comment.AudioContentCommentRepository
|
||||
import kr.co.vividnext.sodalive.content.like.AudioContentLikeRepository
|
||||
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
|
||||
|
@ -32,7 +31,7 @@ class OrderService(
|
|||
fun order(contentId: Long, orderType: OrderType, container: String, member: Member) {
|
||||
val content = audioContentRepository.findByIdAndActive(contentId)
|
||||
?: throw SodaException("잘못된 콘텐츠 입니다\n다시 시도해 주세요.")
|
||||
validateOrder(memberId = member.id!!, content = content, orderType = orderType)
|
||||
validateOrder(memberId = member.id!!, content = content)
|
||||
|
||||
val order = if (content.limited != null && content.remaining != null) {
|
||||
if (content.remaining!! <= 0) throw SodaException("해당 콘텐츠가 매진되었습니다.")
|
||||
|
@ -76,17 +75,11 @@ class OrderService(
|
|||
return order
|
||||
}
|
||||
|
||||
private fun validateOrder(memberId: Long, content: AudioContent, orderType: OrderType) {
|
||||
private fun validateOrder(memberId: Long, content: AudioContent) {
|
||||
if (memberId == content.member!!.id!!) throw SodaException("자신이 올린 콘텐츠는 구매할 수 없습니다.")
|
||||
|
||||
val existOrdered = repository.isExistOrdered(memberId = memberId, contentId = content.id!!)
|
||||
if (existOrdered) throw SodaException("이미 구매한 콘텐츠 입니다.")
|
||||
|
||||
val isOnlyRental = content.purchaseOption == PurchaseOption.RENT_ONLY || content.isOnlyRental
|
||||
if (isOnlyRental && orderType == OrderType.KEEP) throw SodaException("대여만 가능한 콘텐츠 입니다.")
|
||||
|
||||
val isOnlyBuy = content.purchaseOption == PurchaseOption.BUY_ONLY && orderType == OrderType.RENTAL
|
||||
if (isOnlyBuy) throw SodaException("소장만 가능한 콘텐츠 입니다.\n앱 업데이트 후 구매해 주세요.")
|
||||
if (repository.isExistOrdered(memberId = memberId, contentId = content.id!!)) {
|
||||
throw SodaException("이미 구매한 콘텐츠 입니다.")
|
||||
}
|
||||
}
|
||||
|
||||
fun getAudioContentOrderList(
|
||||
|
|
Loading…
Reference in New Issue