shish 2 anni fa
parent
commit
752176705c
1 ha cambiato i file con 14 aggiunte e 1 eliminazioni
  1. 14 1
      biz-ghs/product/classes/ProductClass.php

+ 14 - 1
biz-ghs/product/classes/ProductClass.php

@@ -1693,7 +1693,20 @@ class ProductClass extends BaseClass
                 //计算价格
                 $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['price'] = $price;
+                $productData['skPrice'] = $price;
+                $productData['hjPrice'] = $price;
                 $addProduct = ProductClass::addBaseData($productData);
                 $hdProductId = $addProduct->id ?? 0;
             } else {