shish 1 год назад
Родитель
Сommit
87306274ab
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      biz-hd/refund/classes/HdRefundItemClass.php

+ 8 - 5
biz-hd/refund/classes/HdRefundItemClass.php

@@ -24,16 +24,20 @@ class HdRefundItemClass extends BaseClass
         $itemId = $data['itemId'] ?? 0;
         $num = $data['num'] ?? 0;
         $unitType = $data['unitType'] ?? 0;
-        $bigNum = $unitType == 0 ? $num : 0;
-        $smallNum = $unitType == 1 ? $num : 0;
         $ratio = $data['ratio'] ?? 0;
         $ptItemId = $data['ptItemId'] ?? 0;
         $mainId = $data['mainId'] ?? 0;
         $shopId = $data['shopId'] ?? 0;
         $sjId = $data['sjId'] ?? 0;
         $shopAdminName = $post['shopAdminName'] ?? '';
-
-        if ($bigNum > 0) {
+        if ($unitType == 1) {
+            $bigNum = 0;
+            $smallNum = $num;
+        } else {
+            $bigNum = $num;
+            $smallNum = 0;
+        }
+        if ($bigNum > 0 || $smallNum > 0) {
             $stockInfo = ProductClass::addStock($itemId, $bigNum, $smallNum);
             $recordData = [];
             $recordData['sjId'] = $sjId;
@@ -48,7 +52,6 @@ class HdRefundItemClass extends BaseClass
             $recordData['relateName'] = $shopAdminName;
             StockRecordClass::hdRefundAddRecord($recordData);
         }
-
         return self::add($data);
     }