feat : spu
This commit is contained in:
@@ -168,6 +168,7 @@ class GoodCache
|
||||
private function buildData(&$list): mixed
|
||||
{
|
||||
$spuIds = array_column($list, 'id');
|
||||
$spuImage = array_column($list, 'image_id');
|
||||
|
||||
$skuList = $this->skuModel->getListBySpuIds($spuIds);
|
||||
|
||||
@@ -176,7 +177,7 @@ class GoodCache
|
||||
$skuList = $skuList->toArray();
|
||||
|
||||
$imageIdArr = array_column($skuList,'image_ids');
|
||||
$imageList = $this->getOssObjects($imageIdArr);
|
||||
$imageList = $this->getOssObjects(array_merge($spuImage,$imageIdArr));
|
||||
|
||||
$chefIds = array_column($skuList,'chef_id');
|
||||
$chefList = $this->adminUserModel->getDataByIds($chefIds);
|
||||
@@ -209,6 +210,7 @@ class GoodCache
|
||||
|
||||
foreach ($list as &$item) {
|
||||
$item['sku_list'] = $skuListArr[$item['id']] ?? [];
|
||||
$item['spu_image_url'] = $imageList[$item['image_id']] ?? '';
|
||||
$item['image_list'] = $imageArr[$item['id']] ?? [];
|
||||
$item['price'] = !empty($price[$item['id']]) ? (min($price[$item['id']]) ?? 0) : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user