shish 4 yıl önce
ebeveyn
işleme
931f98afc7

+ 8 - 16
app-ghs/controllers/ProductController.php

@@ -324,7 +324,7 @@ class ProductController extends BaseController
         if (empty($data) || empty($type)) {
             util::fail("参数错误");
         }
-        if (in_array($type, ['inTurn', 'addPrice', 'qtAddPrice', 'byAddPrice', 'hjAddPrice', 'zsAddPrice', 'cost', 'weight', 'ratio', 'ratio', 'price', 'stockWarning', 'shelfLife']) == false) {
+        if (in_array($type, ['inTurn', 'addPrice', 'skAddPrice', 'hjAddPrice', 'zsAddPrice', 'cost', 'weight', 'ratio', 'ratio', 'price', 'stockWarning', 'shelfLife']) == false) {
             util::fail('非法数据修改');
         }
         $data = json_decode($data, true);
@@ -374,18 +374,15 @@ class ProductController extends BaseController
                     $costIds = is_array($arrIds) ? $arrIds : [];
                     if (!empty($costIds) && in_array($id, $costIds)) {
                         $newAddPrice = bcsub($val, $product->cost, 2);
-                        $qtDiff = bcsub($product->addPrice, $product->qtAddPrice, 2);
-                        $newQtAddPrice = bcsub($newAddPrice, $qtDiff, 2);
-                        $byDiff = bcsub($product->addPrice, $product->byAddPrice, 2);
-                        $newByAddPrice = bcsub($newAddPrice, $byDiff, 2);
+                        $qtDiff = bcsub($product->addPrice, $product->skAddPrice, 2);
+                        $newSkAddPrice = bcsub($newAddPrice, $qtDiff, 2);
                         $hjDiff = bcsub($product->addPrice, $product->hjAddPrice, 2);
                         $newHjAddPrice = bcsub($newAddPrice, $hjDiff, 2);
                         $zsDiff = bcsub($product->addPrice, $product->zsAddPrice, 2);
                         $newZsAddPrice = bcsub($newAddPrice, $zsDiff, 2);
                         $params = [];
                         $params['addPrice'] = $newAddPrice;
-                        $params['qtAddPrice'] = $newQtAddPrice;
-                        $params['byAddPrice'] = $newByAddPrice;
+                        $params['skAddPrice'] = $newSkAddPrice;
                         $params['hjAddPrice'] = $newHjAddPrice;
                         $params['zsAddPrice'] = $newZsAddPrice;
 
@@ -423,15 +420,10 @@ class ProductController extends BaseController
             }
             $currentProduct->$type = $val;
             if ($type == 'addPrice') {
-                $qtAddPrice = $currentProduct->qtAddPrice;
-                if ($qtAddPrice <= 0) {
-                    $currentProduct->qtAddPrice = $val - 1 > 0 ? $val - 1 : 1;
-                    $data['qtAddPrice'] = $currentProduct->qtAddPrice;
-                }
-                $byAddPrice = $currentProduct->byAddPrice;
-                if ($byAddPrice <= 0) {
-                    $currentProduct->byAddPrice = $val - 2 > 0 ? $val - 2 : 1;
-                    $data['byAddPrice'] = $currentProduct->byAddPrice;
+                $skAddPrice = $currentProduct->skAddPrice;
+                if ($skAddPrice <= 0) {
+                    $currentProduct->skAddPrice = $val - 1 > 0 ? $val - 1 : 1;
+                    $data['skAddPrice'] = $currentProduct->skAddPrice;
                 }
                 $hjAddPrice = $currentProduct->hjAddPrice;
                 if ($hjAddPrice <= 0) {

+ 3 - 6
app-hd/controllers/ProductController.php

@@ -205,19 +205,16 @@ class ProductController extends BaseController
             $discountPrice = $original['discountPrice'];
             $original['price'] = floatval($discountPrice);
 
+            $skAddPrice = $original['skAddPrice'] ?? 0;
             $addPrice = $original['addPrice'] ?? 0;
-            $qtAddPrice = $original['qtAddPrice'] ?? 0;
-            $byAddPrice = $original['byAddPrice'] ?? 0;
             $hjAddPrice = $original['hjAddPrice'] ?? 0;
             $zsAddPrice = $original['zsAddPrice'] ?? 0;
 
-            $qt = bcsub($addPrice, $qtAddPrice, 2);
-            $by = bcsub($addPrice, $byAddPrice, 2);
+            $sk = bcsub($addPrice, $skAddPrice, 2);
             $hj = bcsub($addPrice, $hjAddPrice, 2);
             $zs = bcsub($addPrice, $zsAddPrice, 2);
 
-            $original['qtPrice'] = floatval(bcsub($discountPrice, $qt, 2));
-            $original['byPrice'] = floatval(bcsub($discountPrice, $by, 2));
+            $original['skPrice'] = floatval(bcsub($discountPrice, $sk, 2));
             $original['hjPrice'] = floatval(bcsub($discountPrice, $hj, 2));
             $original['zsPrice'] = floatval(bcsub($discountPrice, $zs, 2));
         }

+ 7 - 11
biz-ghs/custom/classes/CustomClass.php

@@ -20,32 +20,28 @@ class CustomClass extends BaseClass
     const NOT_BLACK = 1;
     const IS_BLACK = 2;
 
-    const LEVEL_PT = 0; //普通
-    const LEVEL_QT = 1; //青铜
-    const LEVEL_BY = 2; //白银
-    const LEVEL_HJ = 3; //黄金
-    const LEVEL_ZS = 4; //钻石
+    const LEVEL_SK = 0; //散客
+    const LEVEL_PT = 1; //普通
+    const LEVEL_HJ = 2; //黄金
+    const LEVEL_ZS = 3; //钻石
 
     public static $levelMap = [
+        self::LEVEL_SK => '散客',
         self::LEVEL_PT => '普通',
-        self::LEVEL_QT => '青铜',
-        self::LEVEL_BY => '白银',
         self::LEVEL_HJ => '黄金',
         self::LEVEL_ZS => '钻石',
     ];
 
     public static $levelPriceKeyMap = [
+        self::LEVEL_SK => 'skPrice',
         self::LEVEL_PT => 'price',
-        self::LEVEL_QT => 'qtPrice',
-        self::LEVEL_BY => 'byPrice',
         self::LEVEL_HJ => 'hjPrice',
         self::LEVEL_ZS => 'zsPrice',
     ];
 
     public static $levelAddPriceKeyMap = [
+        self::LEVEL_SK => 'skAddPrice',
         self::LEVEL_PT => 'addPrice',
-        self::LEVEL_QT => 'qtAddPrice',
-        self::LEVEL_BY => 'byAddPrice',
         self::LEVEL_HJ => 'hjAddPrice',
         self::LEVEL_ZS => 'zsAddPrice',
     ];

+ 1 - 2
biz-ghs/item/services/ItemService.php

@@ -78,8 +78,7 @@ class ItemService extends BaseService
         $data['variety'] = $ptItem['variety'] ?? 0;
         $data['stockWarning'] = $stockWarning;
         $data['addPrice'] = $ptItem['addPrice'] ?? 0;
-        $data['qtAddPrice'] = $ptItem['qtAddPrice'] ?? 0;
-        $data['byAddPrice'] = $ptItem['byAddPrice'] ?? 0;
+        $data['skAddPrice'] = $ptItem['skAddPrice'] ?? 0;
         $data['hjAddPrice'] = $ptItem['hjAddPrice'] ?? 0;
         $data['zsAddPrice'] = $ptItem['zsAddPrice'] ?? 0;
 

+ 7 - 13
biz-ghs/product/classes/ProductClass.php

@@ -606,17 +606,13 @@ class ProductClass extends BaseClass
                 $currentInfo->discountPrice = 0;
                 $currentInfo->price = $price;
                 $currentInfo->priceLabel = $priceLabel;
+
                 //会员价同步变化
                 $addPrice = $currentInfo->addPrice ?? 0;
-                $qtAddPrice = $currentInfo->qtAddPrice ?? 0;
-                $qt = bcsub($addPrice, $qtAddPrice, 2);
-                if ($qt > 0) {
-                    $currentInfo->qtPrice = bcsub($price, $qt, 2);
-                }
-                $byAddPrice = $currentInfo->byAddPrice ?? 0;
-                $by = bcsub($addPrice, $byAddPrice, 2);
-                if ($by > 0) {
-                    $currentInfo->byPrice = bcsub($price, $by, 2);
+                $skAddPrice = $currentInfo->skAddPrice ?? 0;
+                $sk = bcsub($addPrice, $skAddPrice, 2);
+                if ($sk > 0) {
+                    $currentInfo->skPrice = bcsub($price, $sk, 2);
                 }
                 $hjAddPrice = $currentInfo->hjAddPrice ?? 0;
                 $hj = bcsub($addPrice, $hjAddPrice, 2);
@@ -1089,8 +1085,7 @@ class ProductClass extends BaseClass
             $itemData = $data;
             $itemData['classId'] = $defaultClassId;
             if (isset($data['itemId']) == false || empty($data['itemId'])) {
-                $itemData['qtAddPrice'] = 4;
-                $itemData['byAddPrice'] = 3;
+                $itemData['skAddPrice'] = 3;
                 $itemData['hjAddPrice'] = 2;
                 $itemData['zsAddPrice'] = 1;
                 $ptItemInfo = PtItemClass::addItem($itemData);
@@ -1108,8 +1103,7 @@ class ProductClass extends BaseClass
             $ptItemInfo = PtItemClass::getById($ptItemId, true);
             $data['variety'] = $ptItemInfo->variety ?? 0;
             $data['addPrice'] = $ptItemInfo->addPrice ?? 0;
-            $data['qtAddPrice'] = $ptItemInfo->qtAddPrice ?? 0;
-            $data['byAddPrice'] = $ptItemInfo->byAddPrice ?? 0;
+            $data['skAddPrice'] = $ptItemInfo->skAddPrice ?? 0;
             $data['hjAddPrice'] = $ptItemInfo->hjAddPrice ?? 0;
             $data['zsAddPrice'] = $ptItemInfo->zsAddPrice ?? 0;
 

+ 4 - 5
biz/item/classes/PtItemClass.php

@@ -75,11 +75,10 @@ class PtItemClass extends BaseClass
             util::fail('比例请填写整数,并且大于0');
         }
 
-        $data['addPrice'] = 5;
-        $data['qtAddPrice'] = 4;
-        $data['byAddPrice'] = 3;
-        $data['hjAddPrice'] = 2;
-        $data['zsAddPrice'] = 1;
+        $data['skAddPrice'] = 5;
+        $data['addPrice'] = 4;
+        $data['hjAddPrice'] = 3;
+        $data['zsAddPrice'] = 2;
 
         if (!$classId) {
             util::fail("请选择分类");