修改用户会员价
This commit is contained in:
parent
88fb8b504e
commit
e829ca6f4e
@ -27,12 +27,16 @@ class StoreProductGroupPrice extends BaseModel
|
|||||||
$groupPrices = StoreProductPrice::whereIn('product_id', $productIds)->column('product_id,purchase,cost,vip_price,price');
|
$groupPrices = StoreProductPrice::whereIn('product_id', $productIds)->column('product_id,purchase,cost,vip_price,price');
|
||||||
$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']] ?? [];
|
||||||
|
if (empty($groupPrice)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($userShip == 4) {
|
if ($userShip == 4) {
|
||||||
$item['price'] = $groupPrices[$item['product_id']]['cost'];
|
$item['price'] = $groupPrice['cost'];
|
||||||
} elseif ($userShip == 0) {
|
} elseif ($userShip == 0) {
|
||||||
$item['price'] = $groupPrices[$item['product_id']]['price'];
|
$item['price'] = $groupPrice['price'];
|
||||||
} else {
|
} else {
|
||||||
$item['price'] = $groupPrices[$item['product_id']]['vip_price'];
|
$item['price'] = $groupPrice['vip_price'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $productList;
|
return $productList;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user