更新主表批发价
This commit is contained in:
parent
01857bbd8b
commit
372fe79cfd
@ -324,6 +324,15 @@ class ProductRepository extends BaseRepository
|
||||
unset($data['admin_info']);
|
||||
}
|
||||
|
||||
if(!empty($settleParams['attrValue'])){
|
||||
$wholesalePrices = array_column($settleParams['attrValue'], 'wholesale_price');
|
||||
$minWholesalePrice = min($wholesalePrices);
|
||||
|
||||
if($product['wholesale_price'] > $minWholesalePrice){
|
||||
$product['wholesale_price'] =$minWholesalePrice;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Db::transaction(function () use ($id, $data, $productType, $settleParams, $content, $product, $spuData, $merId) {
|
||||
$productData = $this->save($id, $settleParams, $content, $product, $productType);
|
||||
@ -514,6 +523,13 @@ class ProductRepository extends BaseRepository
|
||||
|
||||
}
|
||||
|
||||
|
||||
$minValues = array_map(function ($item) {
|
||||
return min($item['price'], $item['ot_price']);
|
||||
}, $data['attrValue']);
|
||||
|
||||
$minPriceOtPrice = min($minValues);
|
||||
|
||||
$result = [
|
||||
'store_name' => $data['store_name'],
|
||||
'image' => $data['image'],
|
||||
@ -546,7 +562,7 @@ class ProductRepository extends BaseRepository
|
||||
'refund_switch' => $data['refund_switch'] ?? 0,
|
||||
'mer_form_id' => $data['mer_form_id'] ?? 0,
|
||||
'rate' => $data['rate'] ?? 5.0,
|
||||
'wholesale_price'=> min($data['attrValue'][0]['ot_price'],$data['attrValue'][0]['price'])
|
||||
'wholesale_price'=> $minPriceOtPrice
|
||||
];
|
||||
if (isset($data['extend']))
|
||||
$result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user