크리에이터 채널의 후원랭킹에 이미지에 imageHost를 연결하여 정상적으로 표시되도록 수정
This commit is contained in:
@@ -8,10 +8,6 @@ import kr.co.vividnext.sodalive.can.use.QUseCan.useCan
|
||||
import kr.co.vividnext.sodalive.can.use.QUseCanCalculate.useCanCalculate
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
import org.springframework.stereotype.Repository
|
||||
import java.time.DayOfWeek
|
||||
import java.time.LocalDateTime
|
||||
import java.time.LocalTime
|
||||
import java.time.temporal.TemporalAdjusters
|
||||
|
||||
@Repository
|
||||
class CreatorDonationRankingQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||
@@ -19,12 +15,6 @@ class CreatorDonationRankingQueryRepository(private val queryFactory: JPAQueryFa
|
||||
creatorId: Long,
|
||||
limit: Long
|
||||
): List<DonationRankingProjection> {
|
||||
val now = LocalDateTime.now()
|
||||
val lastMonday = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
||||
.minusWeeks(1)
|
||||
.with(LocalTime.MIN)
|
||||
val lastSunday = lastMonday.plusDays(6).with(LocalTime.MAX)
|
||||
|
||||
val donationCan = useCan.rewardCan.add(useCan.can).sum()
|
||||
return queryFactory
|
||||
.select(
|
||||
@@ -47,7 +37,6 @@ class CreatorDonationRankingQueryRepository(private val queryFactory: JPAQueryFa
|
||||
.or(useCan.canUsage.eq(CanUsage.SPIN_ROULETTE))
|
||||
.or(useCan.canUsage.eq(CanUsage.LIVE))
|
||||
)
|
||||
.and(useCan.createdAt.between(lastMonday, lastSunday))
|
||||
)
|
||||
.offset(0)
|
||||
.limit(limit)
|
||||
|
||||
@@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.explorer.profile
|
||||
|
||||
import kr.co.vividnext.sodalive.explorer.MemberDonationRankingListResponse
|
||||
import kr.co.vividnext.sodalive.explorer.MemberDonationRankingResponse
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.redis.core.RedisTemplate
|
||||
import org.springframework.stereotype.Service
|
||||
import java.time.DayOfWeek
|
||||
@@ -14,14 +15,17 @@ import java.time.temporal.TemporalAdjusters
|
||||
@Service
|
||||
class CreatorDonationRankingService(
|
||||
private val repository: CreatorDonationRankingQueryRepository,
|
||||
private val redisTemplate: RedisTemplate<String, Any>
|
||||
private val redisTemplate: RedisTemplate<String, Any>,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val imageHost: String
|
||||
) {
|
||||
fun getMemberDonationRanking(
|
||||
creatorId: Long,
|
||||
limit: Long,
|
||||
withDonationCan: Boolean
|
||||
): List<MemberDonationRankingResponse> {
|
||||
val cacheKey = "creator_donation_ranking:$creatorId:$limit:$withDonationCan"
|
||||
val cacheKey = "creator_donation_ranking_v2:$creatorId:$limit:$withDonationCan"
|
||||
val cachedData = redisTemplate.opsForValue().get(cacheKey) as? MemberDonationRankingListResponse
|
||||
if (cachedData != null) {
|
||||
return cachedData.rankings
|
||||
@@ -33,7 +37,7 @@ class CreatorDonationRankingService(
|
||||
MemberDonationRankingResponse(
|
||||
it.memberId,
|
||||
it.nickname,
|
||||
it.profileImage,
|
||||
"$imageHost/${it.profileImage}",
|
||||
if (withDonationCan) it.donationCan else 0
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user