From e51af61b3aed2a63fcf90cd3048737e273064313 Mon Sep 17 00:00:00 2001 From: kent Date: Tue, 30 Dec 2025 22:27:08 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B5=AC=EB=8F=85=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=20=EC=9D=BC=EA=B0=84=20API=20=ED=98=B8?= =?UTF-8?q?=EC=B6=9C=20=EC=82=AC=EC=9A=A9=EB=9F=89=20=EC=B6=94=EC=A0=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SubscriptionService::usage()에 api_calls 섹션 추가 - api_request_logs 테이블에서 테넌트별 일간 API 호출 수 집계 - 기본 일간 제한: 10,000회 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/Services/SubscriptionService.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Services/SubscriptionService.php b/app/Services/SubscriptionService.php index 2467af6..fef576f 100644 --- a/app/Services/SubscriptionService.php +++ b/app/Services/SubscriptionService.php @@ -2,6 +2,7 @@ namespace App\Services; +use App\Models\ApiRequestLog; use App\Models\Tenants\DataExport; use App\Models\Tenants\Payment; use App\Models\Tenants\Plan; @@ -319,6 +320,13 @@ public function usage(): array $storageUsed = $tenant->storage_used ?? 0; $storageLimit = $tenant->storage_limit ?? 0; + // API 호출 수 (일간 - 로그는 1일 보관) + $apiCallsUsed = ApiRequestLog::where('tenant_id', $tenantId) + ->whereDate('created_at', now()->toDateString()) + ->count(); + // 기본 일간 API 호출 제한 (10,000회) + $apiCallsLimit = 10000; + // 구독 정보 $subscription = $tenant->subscription; $remainingDays = null; @@ -342,6 +350,11 @@ public function usage(): array 'limit_formatted' => $tenant->getStorageLimitFormatted(), 'percentage' => $storageLimit > 0 ? round(($storageUsed / $storageLimit) * 100, 1) : 0, ], + 'api_calls' => [ + 'used' => $apiCallsUsed, + 'limit' => $apiCallsLimit, + 'percentage' => $apiCallsLimit > 0 ? round(($apiCallsUsed / $apiCallsLimit) * 100, 1) : 0, + ], 'subscription' => [ 'plan' => $planName, 'status' => $subscription?->status,