--- a/app/Services/CarCatalogService.php +++ b/app/Services/CarCatalogService.php @@ -13,6 +13,10 @@ */ class CarCatalogService { + /** 가격 미확인 외장색(상태표)을 응답에 넣을지 — 그것을 처리하는 화면 · API 만 켬(요청 pu=1 · 컨트롤러가 켬 · 2026-11-26 구버전 화면 보호) + * 꺼져 있으면(기본) 미확인 색을 아예 안 냄 → 배포 전에 열린 구버전 화면 · 다른 호출이 price null 을 0원(무료)으로 셀 길이 없음 */ + public bool $priceUnknownOk = false; + /** 국산 site_type_code */ private const DOMESTIC = ['H', 'K', 'G', 'M', 'R', 'C']; @@ -355,7 +359,7 @@ $order = 'ORDER BY s.sort_order IS NULL, s.sort_order, s.car_price, s.sale_model_code LIMIT 1'; $r = $this->db->query( "SELECT s.main_image_path p FROM cars_app.sale_models s - WHERE s.car_code = ? AND s.sale_model_code <> ? AND s.main_image_path IS NOT NULL AND s.main_image_path <> '' $order", [$carCode, $sm] + WHERE s.car_code = ? AND s.sale_model_code <> ? AND s.main_image_path IS NOT NULL AND s.main_image_path <> '' AND s.main_image_path NOT LIKE 'http%' $order", [$carCode, $sm] // 바깥 절대 주소(MB 26 · VW 5 트림 · 이용 허락 전 공식 사진)는 대체 후보에서 뺌 — imgUrl 이 자산 주소를 앞에 붙여 주소가 깨짐(11/26 브라우저 확인) )->getRowArray(); if ($r) return $this->imgUrl($r['p'], null, $makerCode); $o = $this->db->query( @@ -374,9 +378,20 @@ return $first ? ($first['left'] ?? reset($first)) : null; } + /** 가격 미확인 외장색(2026-11-26 사용자 «가격 미확인 표현은 ① 별도 상태표») → colExt 꼴(price null · priceUnknown true) + * 표 exterior_color_status 가 없으면 [] — 표를 만들기 전에도 지금과 같게 동작 · 이 색은 exterior_colors 에 없어 다른 화면 · API · 견적은 0원으로 못 읽음 */ + private function colorStatus(string $sm): array + { + static $has = null; + $has ??= (bool) $this->db->query("SELECT 1 FROM information_schema.tables WHERE table_schema = 'cars_app' AND table_name = 'exterior_color_status'")->getResultArray(); + if (!$has) return []; + return array_map(fn ($r) => $r + ['price' => null, 'priceUnknown' => true, 'choice_yn' => 'Y', 'apply_finish_yn' => null, 'image_local_path' => null, 'file_path' => null, 'fin' => null], + $this->db->query("SELECT color_name nm, color_code code, note priceNote FROM cars_app.exterior_color_status WHERE sale_model_code = ? AND price_status = 'unknown' ORDER BY rank_order", [$sm])->getResultArray()); + } + private function imgUrl(?string $local, ?string $remote, string $makerCode): ?string { - if ($local !== null && $local !== '') return self::ASSET_BASE . $local; + if ($local !== null && $local !== '' && !str_starts_with($local, 'http')) return self::ASSET_BASE . $local; // 사진 경로 칸의 바깥 절대 주소(MB 26 · VW 5 트림)는 안 씀 — 자산 주소를 앞에 붙이면 깨진 요청 · 그대로 쓰면 이용 허락 전 바깥 사진(11/26) · 바깥 주소 칸(remote) 허용 범위는 그대로 if ($remote !== null && $remote !== '') { if (str_starts_with($remote, 'http')) return $remote; if (isset(self::MAKER_WEB[$makerCode])) return self::MAKER_WEB[$makerCode] . $remote; @@ -2797,6 +2812,8 @@ "SELECT color_name nm, color_code code, price, choice_yn, apply_finish_yn, image_local_path, file_path, paint_finish fin FROM cars_app.exterior_colors WHERE sale_model_code = ? ORDER BY rank_order", [$sm] )->getResultArray(); + if ($this->priceUnknownOk) foreach ($this->colorStatus($sm) as $u) // 가격 미확인 외장색(2026-11-26 · 별도 상태표) — 처리하는 화면(pu=1)만 · exterior_colors 에 같은 색이 없을 때만 · 가격 null · 화면 «가격 미확인» + if (!in_array($u['code'], array_column($colExt, 'code'), true)) $colExt[] = $u; $colInt = $db->query( "SELECT color_name nm, color_code code, reality_color_code reality_code, reality_color_name reality, price, image_local_path, garnishes FROM cars_app.interior_colors WHERE sale_model_code = ? ORDER BY id", [$sm]