fix: [수주서] 이미지 URL → file_id 반환으로 변경 (프록시 경유)
- image_url(절대 URL) 대신 image_file_id(파일 ID)만 반환
- 프론트에서 /api/proxy/files/{id}/view 프록시로 인증 포함 요청
This commit is contained in:
@@ -602,7 +602,7 @@ private function groupBendingParts($steelItems, int $shutterCount = 0): array
|
||||
}
|
||||
|
||||
// 품목명 기반 이미지 매칭
|
||||
$imageUrl = null;
|
||||
$imageFileId = null;
|
||||
if (str_contains($name, '연기차단재')) {
|
||||
$groupKey = '연기차단재';
|
||||
} elseif ($isGuideRail) {
|
||||
@@ -618,24 +618,24 @@ private function groupBendingParts($steelItems, int $shutterCount = 0): array
|
||||
// 품목명에서 세부 키워드로 이미지 매칭 시도
|
||||
foreach ($groupImageMap as $itemName => $url) {
|
||||
if (str_contains($name, $itemName) || str_contains($itemName, $name)) {
|
||||
$imageUrl = $url;
|
||||
$imageFileId = $url;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 세부 매칭 실패 시 item_bending(카테고리)으로 매칭
|
||||
if (! $imageUrl) {
|
||||
if (! $imageFileId) {
|
||||
$bendingCategory = match ($groupKey) {
|
||||
'하단마감' => '하단마감재',
|
||||
default => $groupKey,
|
||||
};
|
||||
$imageUrl = $groupImageMap["_group_{$bendingCategory}"] ?? null;
|
||||
$imageFileId = $groupImageMap["_group_{$bendingCategory}"] ?? null;
|
||||
}
|
||||
|
||||
$row = [
|
||||
'name' => $item['item_name'],
|
||||
'spec' => $item['specification'] ?? '-',
|
||||
'qty' => (int) $qty,
|
||||
'image_url' => $imageUrl,
|
||||
'image_file_id' => $imageFileId,
|
||||
];
|
||||
|
||||
if ($groupKey === '연기차단재') {
|
||||
@@ -670,7 +670,7 @@ private function groupBendingParts($steelItems, int $shutterCount = 0): array
|
||||
* item_bending(가이드레일/케이스/하단마감재 등) 기준으로 이미지가 있는 bending_item을 조회하여
|
||||
* item_name → image_url, _group_{category} → image_url 매핑 반환
|
||||
*
|
||||
* @return array<string, string> 매핑 (item_name → url, _group_카테고리 → url)
|
||||
* @return array<string, int> 매핑 (item_name → file_id, _group_카테고리 → file_id)
|
||||
*/
|
||||
private function getBendingGroupImages(int $tenantId): array
|
||||
{
|
||||
@@ -688,17 +688,17 @@ private function getBendingGroupImages(int $tenantId): array
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = url("/api/v1/files/{$file->id}/view");
|
||||
$fileId = $file->id;
|
||||
|
||||
// item_name으로 세부 매칭용
|
||||
if ($bi->item_name) {
|
||||
$result[$bi->item_name] = $url;
|
||||
$result[$bi->item_name] = $fileId;
|
||||
}
|
||||
|
||||
// item_bending(카테고리)별 첫 번째 이미지 → 그룹 대표
|
||||
if ($bi->item_bending && ! isset($groupFirst[$bi->item_bending])) {
|
||||
$groupFirst[$bi->item_bending] = $url;
|
||||
$result["_group_{$bi->item_bending}"] = $url;
|
||||
$groupFirst[$bi->item_bending] = $fileId;
|
||||
$result["_group_{$bi->item_bending}"] = $fileId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user