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;