parent
dc74d203bd
commit
ec0252bae0
|
@ -76,7 +76,7 @@ class SecurityConfig(
|
||||||
.antMatchers("/charge/ads").permitAll()
|
.antMatchers("/charge/ads").permitAll()
|
||||||
.antMatchers("/v2/audio-content/main/home").permitAll()
|
.antMatchers("/v2/audio-content/main/home").permitAll()
|
||||||
.antMatchers("/v2/audio-content/main/home/popular-content-by-creator").permitAll()
|
.antMatchers("/v2/audio-content/main/home/popular-content-by-creator").permitAll()
|
||||||
.antMatchers("/audio-content/ranking").permitAll()
|
.antMatchers("/v2/audio-content/main/home/content/ranking").permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -42,4 +42,21 @@ class AudioContentMainTabHomeController(private val service: AudioContentMainTab
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/content/ranking")
|
||||||
|
fun getContentRanking(
|
||||||
|
@RequestParam("sort-type", required = false) sortType: String? = "매출",
|
||||||
|
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||||
|
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||||
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
|
) = run {
|
||||||
|
ApiResponse.ok(
|
||||||
|
service.getContentRanking(
|
||||||
|
sortType = sortType ?: "매출",
|
||||||
|
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||||
|
contentType = contentType ?: ContentType.ALL,
|
||||||
|
member
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,4 +123,32 @@ class AudioContentMainTabHomeService(
|
||||||
contentType = contentType
|
contentType = contentType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getContentRanking(
|
||||||
|
sortType: String,
|
||||||
|
isAdultContentVisible: Boolean,
|
||||||
|
contentType: ContentType,
|
||||||
|
member: Member?
|
||||||
|
): List<GetAudioContentRankingItem> {
|
||||||
|
val isAdult = member?.auth != null && isAdultContentVisible
|
||||||
|
|
||||||
|
val currentDateTime = LocalDateTime.now()
|
||||||
|
val startDate = currentDateTime
|
||||||
|
.withHour(15)
|
||||||
|
.withMinute(0)
|
||||||
|
.withSecond(0)
|
||||||
|
.minusWeeks(1)
|
||||||
|
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
||||||
|
val endDate = startDate
|
||||||
|
.plusDays(6)
|
||||||
|
|
||||||
|
return rankingService.getContentRanking(
|
||||||
|
memberId = member?.id,
|
||||||
|
isAdult = isAdult,
|
||||||
|
contentType = contentType,
|
||||||
|
startDate = startDate.minusDays(1),
|
||||||
|
endDate = endDate,
|
||||||
|
sortType = sortType
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue