|
|
|
@ -45,41 +45,55 @@ class Store extends BaseModel |
|
|
|
|
public static function detail(int $storeId) |
|
|
|
|
{ |
|
|
|
|
try { |
|
|
|
|
$list = self::withoutGlobalScope() |
|
|
|
|
$list = self::withoutGlobalScope() |
|
|
|
|
->with(['logoImage']) |
|
|
|
|
->where('store_id', '=', $storeId) |
|
|
|
|
->find(); |
|
|
|
|
if($list){ |
|
|
|
|
if($list['new_product_img_id']){ |
|
|
|
|
$new_product_img_id = explode(",",$list['new_product_img_id']); |
|
|
|
|
$file1 = UploadFile::where('file_id','in' ,$new_product_img_id)->select(); |
|
|
|
|
$list['newProductImg'] = $file1 ?: null; |
|
|
|
|
}else{ |
|
|
|
|
if ($list) { |
|
|
|
|
if ($list['new_product_img_id']) { |
|
|
|
|
$img_ids = explode(",", $list['new_product_img_id']); |
|
|
|
|
$files = UploadFile::getFileList($img_ids); |
|
|
|
|
$list['newProductImg'] = $files ?: null; |
|
|
|
|
} else { |
|
|
|
|
$list['newProductImg'] = null; |
|
|
|
|
} |
|
|
|
|
if($list['big_brand_img_id']){ |
|
|
|
|
$big_brand_img_id = explode(",",$list['big_brand_img_id']); |
|
|
|
|
$file2 = UploadFile::where('file_id','in' ,$big_brand_img_id)->select(); |
|
|
|
|
$list['bigBrandImg'] = $file2 ?: null; |
|
|
|
|
}else{ |
|
|
|
|
if ($list['big_brand_img_id']) { |
|
|
|
|
$img_ids = explode(",", $list['big_brand_img_id']); |
|
|
|
|
$files = UploadFile::getFileList($img_ids); |
|
|
|
|
$list['bigBrandImg'] = $files ?: null; |
|
|
|
|
} else { |
|
|
|
|
$list['bigBrandImg'] = null; |
|
|
|
|
} |
|
|
|
|
if($list['new_people_order_img_id']){ |
|
|
|
|
$new_people_order_img_id = explode(",",$list['new_people_order_img_id']); |
|
|
|
|
$file3 = UploadFile::where('file_id','in' ,$new_people_order_img_id)->select(); |
|
|
|
|
$list['newPeopleOrderImg'] = $file3 ?: null; |
|
|
|
|
}else{ |
|
|
|
|
if ($list['new_people_order_img_id']) { |
|
|
|
|
$img_ids = explode(",", $list['new_people_order_img_id']); |
|
|
|
|
$files = UploadFile::getFileList($img_ids); |
|
|
|
|
$list['newPeopleOrderImg'] = $files ?: null; |
|
|
|
|
} else { |
|
|
|
|
$list['newPeopleOrderImg'] = null; |
|
|
|
|
} |
|
|
|
|
if($list['presale_img_id']){ |
|
|
|
|
$presale_img_id = explode(",",$list['presale_img_id']); |
|
|
|
|
$file3 = UploadFile::where('file_id','in' ,$presale_img_id)->select(); |
|
|
|
|
$list['presaleImg'] = $file3 ?: null; |
|
|
|
|
}else{ |
|
|
|
|
if ($list['presale_img_id']) { |
|
|
|
|
$img_ids = explode(",", $list['presale_img_id']); |
|
|
|
|
$files = UploadFile::getFileList($img_ids); |
|
|
|
|
$list['presaleImg'] = $files ?: null; |
|
|
|
|
} else { |
|
|
|
|
$list['presaleImg'] = null; |
|
|
|
|
} |
|
|
|
|
if ($list['flash_sale_img_id']) { |
|
|
|
|
$img_ids = explode(",", $list['flash_sale_img_id']); |
|
|
|
|
$files = UploadFile::getFileList($img_ids); |
|
|
|
|
$list['flashSaleImg'] = $files ?: null; |
|
|
|
|
} else { |
|
|
|
|
$list['flashSaleImg'] = null; |
|
|
|
|
} |
|
|
|
|
if ($list['ranking_img_id']) { |
|
|
|
|
$img_ids = explode(",", $list['ranking_img_id']); |
|
|
|
|
$files = UploadFile::getFileList($img_ids); |
|
|
|
|
$list['rankingImg'] = $files ?: null; |
|
|
|
|
} else { |
|
|
|
|
$list['rankingImg'] = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $list ?? null; |
|
|
|
|
return $list ?? null; |
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|