|
|
@@ -1734,9 +1734,26 @@ class ProductClass extends BaseClass
|
|
|
$productData['classId'] = $defaultClassId;
|
|
|
unset($productData['id']);
|
|
|
$productData['rank'] = 'A';
|
|
|
+ //计算价格
|
|
|
$cost = $v['cost'] ?? 0;
|
|
|
$addPrice = $v['addPrice'] ?? 0;
|
|
|
- $productData['price'] = bcadd($cost, $addPrice, 2);
|
|
|
+ $price = bcadd($cost, $addPrice, 2);
|
|
|
+ $userPrice = $v['userPrice'] ?? 0;
|
|
|
+ if ($cost <= 0 && $price <= 0) {
|
|
|
+ if ($userPrice > 0) {
|
|
|
+ $price = $userPrice;
|
|
|
+ $productData['cost'] = $price;
|
|
|
+ } else {
|
|
|
+ $price = 28;
|
|
|
+ $productData['cost'] = 28;
|
|
|
+ }
|
|
|
+ $productData['skMore'] = 5;
|
|
|
+ $productData['addPrice'] = 4;
|
|
|
+ $productData['hjAddPrice'] = 3;
|
|
|
+ }
|
|
|
+ $productData['price'] = $price;
|
|
|
+ $productData['skPrice'] = $price;
|
|
|
+ $productData['hjPrice'] = $price;
|
|
|
$addProduct = ProductClass::addBaseData($productData);
|
|
|
$hdProductId = $addProduct->id ?? 0;
|
|
|
|