feat : spu

This commit is contained in:
2025-07-24 09:49:00 +08:00
parent 408a2bfa2b
commit 4d0e3907b2
3 changed files with 17 additions and 2 deletions

View File

@@ -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;
}