parent
fcb68be006
commit
37ac52116a
|
@ -12,7 +12,7 @@ class ChatQuotaService(
|
|||
) {
|
||||
companion object {
|
||||
private const val FREE_BUCKET = 10
|
||||
private const val RECHARGE_HOURS = 6L
|
||||
private const val RECHARGE_HOURS = 1L
|
||||
}
|
||||
|
||||
data class QuotaStatus(
|
||||
|
@ -41,20 +41,20 @@ class ChatQuotaService(
|
|||
quota.remainingFree > 0 -> {
|
||||
quota.remainingFree -= 1
|
||||
if (quota.remainingFree + quota.remainingPaid == 0 && quota.nextRechargeAt == null) {
|
||||
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
|
||||
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
|
||||
}
|
||||
}
|
||||
|
||||
quota.remainingPaid > 0 -> {
|
||||
quota.remainingPaid -= 1
|
||||
if (quota.remainingFree + quota.remainingPaid == 0 && quota.nextRechargeAt == null) {
|
||||
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
|
||||
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (quota.nextRechargeAt == null) {
|
||||
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
|
||||
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
|
||||
}
|
||||
throw SodaException("채팅 가능 횟수가 모두 소진되었습니다. 다음 무료 충전 이후 이용해주세요.")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue