作者 赵彬吉

update

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