修改用户会员价

This commit is contained in:
lewis 2025-02-25 11:55:10 +08:00
parent 88fb8b504e
commit e829ca6f4e

View File

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