作者 赵彬吉

update

@@ -32,14 +32,15 @@ class ProductController extends BaseController @@ -32,14 +32,15 @@ class ProductController extends BaseController
32 } 32 }
33 33
34 try { 34 try {
35 - $gallery = Product::where('status', Product::STATUS_ON)->whereNotNull('gallery')->inRandomOrder()->value('gallery');  
36 - $gallery = array_map(function ($item) use ($project) {  
37 - return getImageUrl($item, $project['storage_type'], $project['project_location']);  
38 - }, Arr::pluck($gallery, 'url')); 35 + $info = Product::where('status', Product::STATUS_ON)->whereNotNull('gallery')->inRandomOrder()->select(['title', 'seo_mate', 'gallery'])->first();
  36 + $info['gallery'] = array_map(function ($item) use ($project) {
  37 + $item['url'] = getImageUrl($item['url'], $project['storage_type'], $project['project_location']);
  38 + return $item;
  39 + }, $info['gallery']);
39 } catch (\Exception $e) { 40 } catch (\Exception $e) {
40 LogUtils::error('Project Id: ' . $project_id . ' getProductImages error:' . $e->getMessage()); 41 LogUtils::error('Project Id: ' . $project_id . ' getProductImages error:' . $e->getMessage());
41 - $gallery = []; 42 + $info = [];
42 } 43 }
43 - $this->response('success', Code::SUCCESS, $gallery); 44 + $this->response('success', Code::SUCCESS, $info);
44 } 45 }
45 } 46 }