캐릭터 챗봇 #338
|
@ -61,15 +61,9 @@ class ChatQuotaService(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional
|
||||||
fun getStatus(memberId: Long): QuotaStatus {
|
fun getStatus(memberId: Long): QuotaStatus {
|
||||||
val q = repo.findByMemberId(memberId) ?: return QuotaStatus(
|
return applyRefillOnEnterAndGetStatus(memberId)
|
||||||
totalRemaining = FREE_BUCKET,
|
|
||||||
nextRechargeAtEpochMillis = null
|
|
||||||
)
|
|
||||||
val total = q.remainingFree + q.remainingPaid
|
|
||||||
val epoch = q.nextRechargeAt?.atZone(ZoneId.systemDefault())?.toInstant()?.toEpochMilli()
|
|
||||||
return QuotaStatus(totalRemaining = total, nextRechargeAtEpochMillis = epoch)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
Loading…
Reference in New Issue