From 2915606dffe2d872b544d54f21c0c6fda8719f1a Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Tue, 25 Feb 2025 11:59:36 +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 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/common/model/store_product_group_price/StoreProductGroupPrice.php b/app/common/model/store_product_group_price/StoreProductGroupPrice.php index a6c7e9cf3..d852047ea 100644 --- a/app/common/model/store_product_group_price/StoreProductGroupPrice.php +++ b/app/common/model/store_product_group_price/StoreProductGroupPrice.php @@ -28,13 +28,11 @@ class StoreProductGroupPrice extends BaseModel $groupPrices = reset_index($groupPrices, 'product_id'); foreach ($productList as &$item) { $groupPrice = $groupPrices[$item['product_id']] ?? []; - if (empty($groupPrice)) { + if (empty($groupPrice) || $userShip <= 0) { continue; } if ($userShip == 4) { $item['price'] = $groupPrice['cost']; - } elseif ($userShip == 0) { - $item['price'] = $groupPrice['price']; } else { $item['price'] = $groupPrice['vip_price']; } @@ -46,12 +44,12 @@ class StoreProductGroupPrice extends BaseModel { $groupPrice = StoreProductPrice::whereIn('product_id', $product['id'])->field('product_id,purchase,cost,vip_price,price')->find(); if (!empty($groupPrice) && $groupPrice['product_id'] == $product['id']) { - if ($userShip == 4) { - $product['price'] = $groupPrice['cost']; - } elseif ($userShip == 0) { - $product['price'] = $groupPrice['price']; - } else { - $product['price'] = $groupPrice['vip_price']; + if ($userShip > 0) { + if ($userShip == 4) { + $product['price'] = $groupPrice['cost']; + } else { + $product['price'] = $groupPrice['vip_price']; + } } } return $product;