콘텐츠 메인 - 새로운 콘텐츠, 큐레이션
- 본인인증을 했더라도 19금 콘텐츠 보기를 활성화 하지 않으면 19금 콘텐츠가 보이지 않도록 수정 - 콘텐츠 유형(남성향/여성향)을 선택할 수 있도록 수정
This commit is contained in:
parent
d024e0fa23
commit
0d6e4804f5
|
@ -79,11 +79,17 @@ interface AudioContentQueryRepository {
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
theme: String = "",
|
theme: String = "",
|
||||||
isAdult: Boolean = false,
|
isAdult: Boolean = false,
|
||||||
|
contentType: ContentType = ContentType.ALL,
|
||||||
offset: Long = 0,
|
offset: Long = 0,
|
||||||
limit: Long = 20
|
limit: Long = 20
|
||||||
): List<GetAudioContentMainItem>
|
): List<GetAudioContentMainItem>
|
||||||
|
|
||||||
fun totalCountNewContentFor2Weeks(theme: String, memberId: Long, isAdult: Boolean): Int
|
fun totalCountNewContentFor2Weeks(
|
||||||
|
theme: String,
|
||||||
|
memberId: Long,
|
||||||
|
isAdult: Boolean,
|
||||||
|
contentType: ContentType = ContentType.ALL
|
||||||
|
): Int
|
||||||
|
|
||||||
fun getNewContentUploadCreatorList(
|
fun getNewContentUploadCreatorList(
|
||||||
cloudfrontHost: String,
|
cloudfrontHost: String,
|
||||||
|
@ -95,7 +101,8 @@ interface AudioContentQueryRepository {
|
||||||
fun findAudioContentByCurationId(
|
fun findAudioContentByCurationId(
|
||||||
curationId: Long,
|
curationId: Long,
|
||||||
cloudfrontHost: String,
|
cloudfrontHost: String,
|
||||||
isAdult: Boolean
|
isAdult: Boolean,
|
||||||
|
contentType: ContentType = ContentType.ALL
|
||||||
): List<GetAudioContentMainItem>
|
): List<GetAudioContentMainItem>
|
||||||
|
|
||||||
fun getAudioContentRanking(
|
fun getAudioContentRanking(
|
||||||
|
@ -417,7 +424,12 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
.size
|
.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun totalCountNewContentFor2Weeks(theme: String, memberId: Long, isAdult: Boolean): Int {
|
override fun totalCountNewContentFor2Weeks(
|
||||||
|
theme: String,
|
||||||
|
memberId: Long,
|
||||||
|
isAdult: Boolean,
|
||||||
|
contentType: ContentType
|
||||||
|
): Int {
|
||||||
var where = audioContent.isActive.isTrue
|
var where = audioContent.isActive.isTrue
|
||||||
.and(audioContent.duration.isNotNull)
|
.and(audioContent.duration.isNotNull)
|
||||||
.and(audioContent.releaseDate.goe(LocalDateTime.now().minusWeeks(2)))
|
.and(audioContent.releaseDate.goe(LocalDateTime.now().minusWeeks(2)))
|
||||||
|
@ -429,6 +441,12 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
|
|
||||||
if (!isAdult) {
|
if (!isAdult) {
|
||||||
where = where.and(audioContent.isAdult.isFalse)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
|
} else {
|
||||||
|
if (contentType != ContentType.ALL) {
|
||||||
|
where = where.and(
|
||||||
|
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 1 else 0)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme.isNotBlank()) {
|
if (theme.isNotBlank()) {
|
||||||
|
@ -450,6 +468,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
theme: String,
|
theme: String,
|
||||||
isAdult: Boolean,
|
isAdult: Boolean,
|
||||||
|
contentType: ContentType,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long
|
limit: Long
|
||||||
): List<GetAudioContentMainItem> {
|
): List<GetAudioContentMainItem> {
|
||||||
|
@ -464,6 +483,12 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
|
|
||||||
if (!isAdult) {
|
if (!isAdult) {
|
||||||
where = where.and(audioContent.isAdult.isFalse)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
|
} else {
|
||||||
|
if (contentType != ContentType.ALL) {
|
||||||
|
where = where.and(
|
||||||
|
audioContent.member.auth.gender.eq(if (contentType == ContentType.MALE) 1 else 0)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme.isNotBlank()) {
|
if (theme.isNotBlank()) {
|
||||||
|
@ -514,7 +539,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
.orderBy(Expressions.numberTemplate(Double::class.java, "function('rand')").asc())
|
.orderBy(Expressions.numberTemplate(Double::class.java, "function('rand')").asc())
|
||||||
.limit(20)
|
.limit(20)
|
||||||
.fetch()
|
.fetch()
|
||||||
.asSequence()
|
|
||||||
.map {
|
.map {
|
||||||
GetNewContentUploadCreator(
|
GetNewContentUploadCreator(
|
||||||
it.id!!,
|
it.id!!,
|
||||||
|
@ -526,7 +550,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.toList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAudioContentMainBannerList(isAdult: Boolean): List<AudioContentBanner> {
|
override fun getAudioContentMainBannerList(isAdult: Boolean): List<AudioContentBanner> {
|
||||||
|
@ -562,7 +585,8 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
override fun findAudioContentByCurationId(
|
override fun findAudioContentByCurationId(
|
||||||
curationId: Long,
|
curationId: Long,
|
||||||
cloudfrontHost: String,
|
cloudfrontHost: String,
|
||||||
isAdult: Boolean
|
isAdult: Boolean,
|
||||||
|
contentType: ContentType
|
||||||
): List<GetAudioContentMainItem> {
|
): List<GetAudioContentMainItem> {
|
||||||
var where = audioContent.isActive.isTrue
|
var where = audioContent.isActive.isTrue
|
||||||
.and(audioContent.member.isNotNull)
|
.and(audioContent.member.isNotNull)
|
||||||
|
@ -572,6 +596,14 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
|
|
||||||
if (!isAdult) {
|
if (!isAdult) {
|
||||||
where = where.and(audioContent.isAdult.isFalse)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
|
} else {
|
||||||
|
if (contentType != ContentType.ALL) {
|
||||||
|
where = where.and(
|
||||||
|
audioContent.member.auth.gender.eq(
|
||||||
|
if (contentType == ContentType.MALE) 1 else 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package kr.co.vividnext.sodalive.content
|
||||||
|
|
||||||
|
enum class ContentType {
|
||||||
|
// 전체
|
||||||
|
ALL,
|
||||||
|
|
||||||
|
// 남성향
|
||||||
|
MALE,
|
||||||
|
|
||||||
|
// 여성향
|
||||||
|
FEMALE
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.main
|
||||||
|
|
||||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
import kr.co.vividnext.sodalive.common.SodaException
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
|
import kr.co.vividnext.sodalive.content.ContentType
|
||||||
import kr.co.vividnext.sodalive.content.order.OrderService
|
import kr.co.vividnext.sodalive.content.order.OrderService
|
||||||
import kr.co.vividnext.sodalive.member.Member
|
import kr.co.vividnext.sodalive.member.Member
|
||||||
import org.springframework.data.domain.Pageable
|
import org.springframework.data.domain.Pageable
|
||||||
|
@ -82,16 +83,28 @@ class AudioContentMainController(
|
||||||
@GetMapping("/new/all")
|
@GetMapping("/new/all")
|
||||||
fun getNewContentAllByTheme(
|
fun getNewContentAllByTheme(
|
||||||
@RequestParam("theme") theme: String,
|
@RequestParam("theme") theme: String,
|
||||||
|
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||||
|
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||||
pageable: Pageable
|
pageable: Pageable
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
|
|
||||||
ApiResponse.ok(service.getNewContentFor2WeeksByTheme(theme, member, pageable))
|
ApiResponse.ok(
|
||||||
|
service.getNewContentFor2WeeksByTheme(
|
||||||
|
theme = theme,
|
||||||
|
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||||
|
contentType = contentType ?: ContentType.ALL,
|
||||||
|
member = member,
|
||||||
|
pageable = pageable
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/curation-list")
|
@GetMapping("/curation-list")
|
||||||
fun getCurationList(
|
fun getCurationList(
|
||||||
|
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||||
|
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||||
pageable: Pageable
|
pageable: Pageable
|
||||||
) = run {
|
) = run {
|
||||||
|
@ -100,7 +113,8 @@ class AudioContentMainController(
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.getAudioContentCurationListWithPaging(
|
service.getAudioContentCurationListWithPaging(
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
isAdult = member.auth != null,
|
isAdult = member.auth != null && (isAdultContentVisible ?: true),
|
||||||
|
contentType = contentType ?: ContentType.ALL,
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong()
|
limit = pageable.pageSize.toLong()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package kr.co.vividnext.sodalive.content.main
|
package kr.co.vividnext.sodalive.content.main
|
||||||
|
|
||||||
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
||||||
|
import kr.co.vividnext.sodalive.content.ContentType
|
||||||
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerType
|
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerType
|
||||||
import kr.co.vividnext.sodalive.content.main.banner.GetAudioContentBannerResponse
|
import kr.co.vividnext.sodalive.content.main.banner.GetAudioContentBannerResponse
|
||||||
import kr.co.vividnext.sodalive.content.main.curation.GetAudioContentCurationResponse
|
import kr.co.vividnext.sodalive.content.main.curation.GetAudioContentCurationResponse
|
||||||
|
@ -45,20 +46,29 @@ class AudioContentMainService(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun getNewContentFor2WeeksByTheme(theme: String, member: Member, pageable: Pageable): GetNewContentAllResponse {
|
fun getNewContentFor2WeeksByTheme(
|
||||||
val totalCount =
|
theme: String,
|
||||||
repository.totalCountNewContentFor2Weeks(theme, memberId = member.id!!, isAdult = member.auth != null)
|
isAdultContentVisible: Boolean,
|
||||||
|
contentType: ContentType,
|
||||||
|
member: Member,
|
||||||
|
pageable: Pageable
|
||||||
|
): GetNewContentAllResponse {
|
||||||
|
val totalCount = repository.totalCountNewContentFor2Weeks(
|
||||||
|
theme,
|
||||||
|
memberId = member.id!!,
|
||||||
|
isAdult = member.auth != null && isAdultContentVisible,
|
||||||
|
contentType = contentType
|
||||||
|
)
|
||||||
val items = repository.findByThemeFor2Weeks(
|
val items = repository.findByThemeFor2Weeks(
|
||||||
cloudfrontHost = imageHost,
|
cloudfrontHost = imageHost,
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
theme = theme,
|
theme = theme,
|
||||||
isAdult = member.auth != null,
|
isAdult = member.auth != null && isAdultContentVisible,
|
||||||
|
contentType = contentType,
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong()
|
limit = pageable.pageSize.toLong()
|
||||||
)
|
)
|
||||||
.asSequence()
|
|
||||||
.filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.creatorId) }
|
.filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.creatorId) }
|
||||||
.toList()
|
|
||||||
|
|
||||||
return GetNewContentAllResponse(totalCount, items)
|
return GetNewContentAllResponse(totalCount, items)
|
||||||
}
|
}
|
||||||
|
@ -130,26 +140,28 @@ class AudioContentMainService(
|
||||||
cacheNames = ["default"],
|
cacheNames = ["default"],
|
||||||
key = "'getAudioContentCurationListWithPaging:' + #memberId + ':' + #isAdult + ':' + #offset + ':' + #limit"
|
key = "'getAudioContentCurationListWithPaging:' + #memberId + ':' + #isAdult + ':' + #offset + ':' + #limit"
|
||||||
)
|
)
|
||||||
fun getAudioContentCurationListWithPaging(memberId: Long, isAdult: Boolean, offset: Long, limit: Long) =
|
fun getAudioContentCurationListWithPaging(
|
||||||
repository.getAudioContentCurationList(isAdult = isAdult, offset = offset, limit = limit)
|
memberId: Long,
|
||||||
.asSequence()
|
isAdult: Boolean,
|
||||||
.map {
|
contentType: ContentType,
|
||||||
GetAudioContentCurationResponse(
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
) = repository.getAudioContentCurationList(isAdult = isAdult, offset = offset, limit = limit)
|
||||||
|
.map {
|
||||||
|
GetAudioContentCurationResponse(
|
||||||
|
curationId = it.id!!,
|
||||||
|
title = it.title,
|
||||||
|
description = it.description,
|
||||||
|
contents = repository.findAudioContentByCurationId(
|
||||||
curationId = it.id!!,
|
curationId = it.id!!,
|
||||||
title = it.title,
|
cloudfrontHost = imageHost,
|
||||||
description = it.description,
|
isAdult = isAdult,
|
||||||
contents = repository.findAudioContentByCurationId(
|
contentType = contentType
|
||||||
curationId = it.id!!,
|
|
||||||
cloudfrontHost = imageHost,
|
|
||||||
isAdult = isAdult
|
|
||||||
)
|
|
||||||
.asSequence()
|
|
||||||
.filter { content ->
|
|
||||||
!blockMemberRepository.isBlocked(blockedMemberId = memberId, memberId = content.creatorId)
|
|
||||||
}
|
|
||||||
.toList()
|
|
||||||
)
|
)
|
||||||
}
|
.filter { content ->
|
||||||
.filter { it.contents.isNotEmpty() }
|
!blockMemberRepository.isBlocked(blockedMemberId = memberId, memberId = content.creatorId)
|
||||||
.toList()
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.filter { it.contents.isNotEmpty() }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue