parent
d45a25258e
commit
519c63a023
|
@ -74,6 +74,8 @@ class SecurityConfig(
|
|||
.antMatchers("/stplat/terms_of_service").permitAll()
|
||||
.antMatchers("/stplat/privacy_policy").permitAll()
|
||||
.antMatchers("/charge/ads").permitAll()
|
||||
.antMatchers("/v2/audio-content/main/home").permitAll()
|
||||
.antMatchers("/v2/audio-content/main/home/popular-content-by-creator").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.build()
|
||||
|
|
|
@ -13,12 +13,12 @@ class AudioContentBannerService(
|
|||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val imageHost: String
|
||||
) {
|
||||
fun getBannerList(tabId: Long, memberId: Long, isAdult: Boolean): List<GetAudioContentBannerResponse> {
|
||||
fun getBannerList(tabId: Long, memberId: Long?, isAdult: Boolean): List<GetAudioContentBannerResponse> {
|
||||
return repository.getAudioContentMainBannerList(tabId, isAdult)
|
||||
.filter {
|
||||
if (it.type == AudioContentBannerType.CREATOR && it.creator != null) {
|
||||
if (it.type == AudioContentBannerType.CREATOR && it.creator != null && memberId != null) {
|
||||
!blockMemberRepository.isBlocked(blockedMemberId = memberId, memberId = it.creator!!.id!!)
|
||||
} else if (it.type == AudioContentBannerType.SERIES && it.series != null) {
|
||||
} else if (it.type == AudioContentBannerType.SERIES && it.series != null && memberId != null) {
|
||||
!blockMemberRepository.isBlocked(blockedMemberId = memberId, memberId = it.series!!.member!!.id!!)
|
||||
} else {
|
||||
true
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package kr.co.vividnext.sodalive.content.main.tab.home
|
||||
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.content.ContentType
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||
|
@ -19,8 +18,6 @@ class AudioContentMainTabHomeController(private val service: AudioContentMainTab
|
|||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.fetchData(
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
|
@ -37,12 +34,10 @@ class AudioContentMainTabHomeController(private val service: AudioContentMainTab
|
|||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.getPopularContentByCreator(
|
||||
creatorId = creatorId,
|
||||
isAdult = member.auth != null && (isAdultContentVisible ?: true),
|
||||
isAdult = member?.auth != null && (isAdultContentVisible ?: true),
|
||||
contentType = contentType ?: ContentType.ALL
|
||||
)
|
||||
)
|
||||
|
|
|
@ -23,7 +23,7 @@ class AudioContentMainTabHomeService(
|
|||
fun fetchData(
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
member: Member
|
||||
member: Member?
|
||||
): GetContentMainTabHomeResponse {
|
||||
// 주간 랭킹 기간
|
||||
val currentDateTime = LocalDateTime.now()
|
||||
|
@ -42,7 +42,7 @@ class AudioContentMainTabHomeService(
|
|||
val formattedLastMonday = startDate.format(startDateFormatter)
|
||||
val formattedLastSunday = endDate.format(endDateFormatter)
|
||||
|
||||
val isAdult = member.auth != null && isAdultContentVisible
|
||||
val isAdult = member?.auth != null && isAdultContentVisible
|
||||
|
||||
// 최근 공지사항
|
||||
val latestNotice = noticeService.getLatestNotice()
|
||||
|
@ -50,19 +50,19 @@ class AudioContentMainTabHomeService(
|
|||
// 메인 배너 (홈)
|
||||
val contentBannerList = bannerService.getBannerList(
|
||||
tabId = 1,
|
||||
memberId = member.id!!,
|
||||
memberId = member?.id,
|
||||
isAdult = isAdult
|
||||
)
|
||||
|
||||
// 인기 크리에이터
|
||||
val rankCreatorList = rankingService.getCreatorRanking(
|
||||
memberId = member.id!!,
|
||||
memberId = member?.id,
|
||||
rankingDate = "$formattedLastMonday ~ $formattedLastSunday"
|
||||
)
|
||||
|
||||
// 인기 시리즈
|
||||
val rankSeriesList = rankingService.getSeriesRanking(
|
||||
memberId = member.id!!,
|
||||
memberId = member?.id,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
startDate = startDate.minusDays(1),
|
||||
|
@ -71,7 +71,7 @@ class AudioContentMainTabHomeService(
|
|||
|
||||
// 인기 콘텐츠
|
||||
val rankContentList = rankingService.getContentRanking(
|
||||
memberId = member.id!!,
|
||||
memberId = member?.id,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
startDate = startDate.minusDays(1),
|
||||
|
@ -82,7 +82,7 @@ class AudioContentMainTabHomeService(
|
|||
val eventBannerList = eventService.getEventList(isAdult = isAdult)
|
||||
|
||||
val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20(
|
||||
memberId = member.id!!,
|
||||
memberId = member?.id,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
startDate = startDate.minusDays(1),
|
||||
|
|
|
@ -43,7 +43,7 @@ class RankingRepository(
|
|||
}
|
||||
|
||||
fun getAudioContentRanking(
|
||||
memberId: Long,
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
startDate: LocalDateTime,
|
||||
|
@ -110,7 +110,40 @@ class RankingRepository(
|
|||
.innerJoin(audioContentComment.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
}
|
||||
|
||||
"댓글" -> {
|
||||
select
|
||||
.from(audioContentComment)
|
||||
.innerJoin(audioContentComment.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
}
|
||||
|
||||
"좋아요" -> {
|
||||
select
|
||||
.from(audioContentLike)
|
||||
.innerJoin(audioContentLike.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
}
|
||||
|
||||
else -> {
|
||||
select
|
||||
.from(order)
|
||||
.innerJoin(order.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
}
|
||||
}
|
||||
|
||||
if (memberId != null) {
|
||||
select = select.leftJoin(blockMember).on(blockMemberCondition)
|
||||
}
|
||||
|
||||
select = when (sortType) {
|
||||
"후원" -> {
|
||||
select
|
||||
.where(
|
||||
where
|
||||
.and(audioContentComment.isActive.isTrue)
|
||||
|
@ -124,11 +157,6 @@ class RankingRepository(
|
|||
|
||||
"댓글" -> {
|
||||
select
|
||||
.from(audioContentComment)
|
||||
.innerJoin(audioContentComment.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(
|
||||
where
|
||||
.and(audioContentComment.isActive.isTrue)
|
||||
|
@ -141,11 +169,6 @@ class RankingRepository(
|
|||
|
||||
"좋아요" -> {
|
||||
select
|
||||
.from(audioContentLike)
|
||||
.innerJoin(audioContentLike.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(
|
||||
where
|
||||
.and(audioContentLike.isActive.isTrue)
|
||||
|
@ -158,11 +181,6 @@ class RankingRepository(
|
|||
|
||||
else -> {
|
||||
select
|
||||
.from(order)
|
||||
.innerJoin(order.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(
|
||||
where
|
||||
.and(order.isActive.isTrue)
|
||||
|
@ -181,7 +199,7 @@ class RankingRepository(
|
|||
}
|
||||
|
||||
fun getSeriesRanking(
|
||||
memberId: Long,
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
startDate: LocalDateTime,
|
||||
|
@ -221,14 +239,19 @@ class RankingRepository(
|
|||
}
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
var select = queryFactory
|
||||
.select(series)
|
||||
.from(seriesContent)
|
||||
.innerJoin(seriesContent.series, series)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.innerJoin(series.member, member)
|
||||
.leftJoin(order).on(audioContent.id.eq(order.audioContent.id))
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
|
||||
if (memberId != null) {
|
||||
select = select.leftJoin(blockMember).on(blockMemberCondition)
|
||||
}
|
||||
|
||||
return select
|
||||
.where(where)
|
||||
.groupBy(series.id)
|
||||
.orderBy(
|
||||
|
@ -408,7 +431,7 @@ class RankingRepository(
|
|||
}
|
||||
|
||||
fun fetchCreatorBySellContentCountRankTop20(
|
||||
memberId: Long,
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
startDate: LocalDateTime,
|
||||
|
@ -451,7 +474,7 @@ class RankingRepository(
|
|||
}
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
var select = queryFactory
|
||||
.select(
|
||||
QContentCreatorResponse(
|
||||
member.id,
|
||||
|
@ -462,7 +485,12 @@ class RankingRepository(
|
|||
.from(audioContent)
|
||||
.innerJoin(member).on(memberCondition)
|
||||
.leftJoin(order).on(ordersCondition)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
|
||||
if (memberId != null) {
|
||||
select = select.leftJoin(blockMember).on(blockMemberCondition)
|
||||
}
|
||||
|
||||
return select
|
||||
.where(where)
|
||||
.groupBy(member.id)
|
||||
.having(audioContent.id.count().goe(4))
|
||||
|
|
|
@ -23,10 +23,16 @@ class RankingService(
|
|||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val imageHost: String
|
||||
) {
|
||||
fun getCreatorRanking(memberId: Long, rankingDate: String): GetExplorerSectionResponse {
|
||||
fun getCreatorRanking(memberId: Long?, rankingDate: String): GetExplorerSectionResponse {
|
||||
val creatorRankings = repository
|
||||
.getCreatorRankings()
|
||||
.filter { !memberService.isBlocked(blockedMemberId = memberId, memberId = it.id!!) }
|
||||
.filter {
|
||||
if (memberId != null) {
|
||||
!memberService.isBlocked(blockedMemberId = memberId, memberId = it.id!!)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
.map { it.toExplorerSectionCreator(imageHost) }
|
||||
|
||||
return GetExplorerSectionResponse(
|
||||
|
@ -39,7 +45,7 @@ class RankingService(
|
|||
}
|
||||
|
||||
fun getContentRanking(
|
||||
memberId: Long,
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
startDate: LocalDateTime,
|
||||
|
@ -71,7 +77,7 @@ class RankingService(
|
|||
}
|
||||
|
||||
fun getSeriesRanking(
|
||||
memberId: Long,
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
startDate: LocalDateTime,
|
||||
|
@ -211,7 +217,7 @@ class RankingService(
|
|||
}
|
||||
|
||||
fun fetchCreatorBySellContentCountRankTop20(
|
||||
memberId: Long,
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
startDate: LocalDateTime,
|
||||
|
|
Loading…
Reference in New Issue