From e829ca6f4ead8d3eee8b44c7a4d0637321968abe Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Tue, 25 Feb 2025 11:55:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreProductGroupPrice.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/common/model/store_product_group_price/StoreProductGroupPrice.php b/app/common/model/store_product_group_price/StoreProductGroupPrice.php index 8317e033..a6c7e9cf 100644 --- a/app/common/model/store_product_group_price/StoreProductGroupPrice.php +++ b/app/common/model/store_product_group_price/StoreProductGroupPrice.php @@ -27,12 +27,16 @@ class StoreProductGroupPrice extends BaseModel $groupPrices = StoreProductPrice::whereIn('product_id', $productIds)->column('product_id,purchase,cost,vip_price,price'); $groupPrices = reset_index($groupPrices, 'product_id'); foreach ($productList as &$item) { + $groupPrice = $groupPrices[$item['product_id']] ?? []; + if (empty($groupPrice)) { + continue; + } if ($userShip == 4) { - $item['price'] = $groupPrices[$item['product_id']]['cost']; + $item['price'] = $groupPrice['cost']; } elseif ($userShip == 0) { - $item['price'] = $groupPrices[$item['product_id']]['price']; + $item['price'] = $groupPrice['price']; } else { - $item['price'] = $groupPrices[$item['product_id']]['vip_price']; + $item['price'] = $groupPrice['vip_price']; } } return $productList;