style: Pint 포맷팅 적용
This commit is contained in:
@@ -26,7 +26,7 @@ public function inquiry(Request $request): View|Response
|
||||
return response('', 200)->header('HX-Redirect', route('credit.inquiry.index'));
|
||||
}
|
||||
|
||||
$service = new CooconService();
|
||||
$service = new CooconService;
|
||||
$hasConfig = $service->hasConfig();
|
||||
|
||||
// 검색 조건
|
||||
@@ -42,10 +42,10 @@ public function inquiry(Request $request): View|Response
|
||||
|
||||
// 기간 검색
|
||||
if ($request->filled('start_date')) {
|
||||
$query->where('inquired_at', '>=', $request->input('start_date') . ' 00:00:00');
|
||||
$query->where('inquired_at', '>=', $request->input('start_date').' 00:00:00');
|
||||
}
|
||||
if ($request->filled('end_date')) {
|
||||
$query->where('inquired_at', '<=', $request->input('end_date') . ' 23:59:59');
|
||||
$query->where('inquired_at', '<=', $request->input('end_date').' 23:59:59');
|
||||
}
|
||||
|
||||
// 이슈 있는 것만
|
||||
@@ -79,9 +79,9 @@ public function search(Request $request): JsonResponse
|
||||
|
||||
$companyKey = preg_replace('/[^0-9]/', '', $request->input('company_key'));
|
||||
|
||||
$cooconService = new CooconService();
|
||||
$cooconService = new CooconService;
|
||||
|
||||
if (!$cooconService->hasConfig()) {
|
||||
if (! $cooconService->hasConfig()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => '쿠콘 API 설정이 없습니다. 설정을 먼저 등록해주세요.',
|
||||
@@ -92,7 +92,7 @@ public function search(Request $request): JsonResponse
|
||||
$apiResult = $cooconService->getAllCreditInfo($companyKey);
|
||||
|
||||
// 국세청 사업자등록 상태 조회
|
||||
$ntsService = new NtsBusinessService();
|
||||
$ntsService = new NtsBusinessService;
|
||||
$ntsResult = $ntsService->getBusinessStatus($companyKey);
|
||||
|
||||
// DB에 저장 (tenant_id는 세션에서 가져옴)
|
||||
@@ -354,14 +354,14 @@ public function toggleConfig(int $id): JsonResponse
|
||||
{
|
||||
$config = CooconConfig::findOrFail($id);
|
||||
|
||||
if (!$config->is_active) {
|
||||
if (! $config->is_active) {
|
||||
// 같은 환경에서 활성화된 설정이 이미 있으면 비활성화
|
||||
CooconConfig::where('environment', $config->environment)
|
||||
->where('is_active', true)
|
||||
->update(['is_active' => false]);
|
||||
}
|
||||
|
||||
$config->update(['is_active' => !$config->is_active]);
|
||||
$config->update(['is_active' => ! $config->is_active]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
@@ -380,9 +380,9 @@ public function testConnection(Request $request): JsonResponse
|
||||
]);
|
||||
|
||||
$companyKey = $request->input('company_key');
|
||||
$service = new CooconService();
|
||||
$service = new CooconService;
|
||||
|
||||
if (!$service->hasConfig()) {
|
||||
if (! $service->hasConfig()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => '쿠콘 API 설정이 없습니다.',
|
||||
|
||||
@@ -44,8 +44,8 @@ public function index(Request $request): View|Response
|
||||
$startDate = "{$year}-01-01 00:00:00";
|
||||
$endDate = "{$year}-12-31 23:59:59";
|
||||
} elseif ($viewType === 'custom') {
|
||||
$startDate = $request->input('start_date', date('Y-m-01')) . ' 00:00:00';
|
||||
$endDate = $request->input('end_date', date('Y-m-t')) . ' 23:59:59';
|
||||
$startDate = $request->input('start_date', date('Y-m-01')).' 00:00:00';
|
||||
$endDate = $request->input('end_date', date('Y-m-t')).' 23:59:59';
|
||||
} else {
|
||||
$startDate = "{$year}-{$month}-01 00:00:00";
|
||||
$endDate = date('Y-m-t 23:59:59', strtotime($startDate));
|
||||
@@ -116,7 +116,7 @@ private function getAllTenantsUsage(string $startDate, string $endDate, string $
|
||||
$tenantId = $row->tenant_id;
|
||||
$month = $row->month;
|
||||
|
||||
if (!isset($monthlyData[$tenantId])) {
|
||||
if (! isset($monthlyData[$tenantId])) {
|
||||
$monthlyData[$tenantId] = [];
|
||||
}
|
||||
$monthlyData[$tenantId][$month] = $row->total_count;
|
||||
@@ -173,7 +173,7 @@ private function getAllTenantsUsage(string $startDate, string $endDate, string $
|
||||
}
|
||||
|
||||
// 정렬: 조회 건수 내림차순
|
||||
usort($details, fn($a, $b) => $b['count'] - $a['count']);
|
||||
usort($details, fn ($a, $b) => $b['count'] - $a['count']);
|
||||
|
||||
return [
|
||||
'total_count' => $totalCount,
|
||||
@@ -228,7 +228,7 @@ private function getSingleTenantUsage(int $tenantId, string $startDate, string $
|
||||
$existingMonths = collect($details)->pluck('month')->toArray();
|
||||
for ($m = 1; $m <= 12; $m++) {
|
||||
$monthKey = sprintf('%s-%02d', $year, $m);
|
||||
if (!in_array($monthKey, $existingMonths)) {
|
||||
if (! in_array($monthKey, $existingMonths)) {
|
||||
$details[] = [
|
||||
'tenant_id' => $tenantId,
|
||||
'tenant_name' => $tenant?->company_name ?? '(삭제됨)',
|
||||
@@ -241,7 +241,7 @@ private function getSingleTenantUsage(int $tenantId, string $startDate, string $
|
||||
}
|
||||
}
|
||||
// 월 순서로 정렬
|
||||
usort($details, fn($a, $b) => strcmp($a['month'], $b['month']));
|
||||
usort($details, fn ($a, $b) => strcmp($a['month'], $b['month']));
|
||||
}
|
||||
|
||||
return [
|
||||
@@ -257,6 +257,7 @@ private function getSingleTenantUsage(int $tenantId, string $startDate, string $
|
||||
private function calculateFee(int $count): int
|
||||
{
|
||||
$paidCount = max(0, $count - self::FREE_MONTHLY_QUOTA);
|
||||
|
||||
return $paidCount * self::ADDITIONAL_FEE_PER_INQUIRY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user