修改用户会员价

This commit is contained in:
lewis 2025-02-25 11:59:36 +08:00
parent e829ca6f4e
commit 2915606dff

View File

@ -28,13 +28,11 @@ class StoreProductGroupPrice extends BaseModel
$groupPrices = reset_index($groupPrices, 'product_id'); $groupPrices = reset_index($groupPrices, 'product_id');
foreach ($productList as &$item) { foreach ($productList as &$item) {
$groupPrice = $groupPrices[$item['product_id']] ?? []; $groupPrice = $groupPrices[$item['product_id']] ?? [];
if (empty($groupPrice)) { if (empty($groupPrice) || $userShip <= 0) {
continue; continue;
} }
if ($userShip == 4) { if ($userShip == 4) {
$item['price'] = $groupPrice['cost']; $item['price'] = $groupPrice['cost'];
} elseif ($userShip == 0) {
$item['price'] = $groupPrice['price'];
} else { } else {
$item['price'] = $groupPrice['vip_price']; $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(); $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 (!empty($groupPrice) && $groupPrice['product_id'] == $product['id']) {
if ($userShip == 4) { if ($userShip > 0) {
$product['price'] = $groupPrice['cost']; if ($userShip == 4) {
} elseif ($userShip == 0) { $product['price'] = $groupPrice['cost'];
$product['price'] = $groupPrice['price']; } else {
} else { $product['price'] = $groupPrice['vip_price'];
$product['price'] = $groupPrice['vip_price']; }
} }
} }
return $product; return $product;