Просмотр исходного кода

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 4 лет назад
Родитель
Сommit
389c6bfcd7
1 измененных файлов с 6 добавлено и 6 удалено
  1. 6 6
      app/Services/OwnerPriceOperationService.php

+ 6 - 6
app/Services/OwnerPriceOperationService.php

@@ -432,13 +432,15 @@ class OwnerPriceOperationService
         if (!$matchObject)return -1;
         $total = 0; //商品总数
         foreach ($matchObject as $commodity)$total += $commodity[$columnMapping[8]]; //取对象内商品数量总数将其当作子属性插入原对象
-        $surcharge = 0;
         $unitName = "";
-        if ($obj->surcharge_unit_id && $obj->surcharge && isset($units[$rule->surcharge_unit_id])){
+        $surcharge = 0;
+        if ($obj->surcharge_unit_id && $obj->surcharge){
             if ($units[$obj->surcharge_unit_id] == '件')$surcharge += $obj->surcharge*$total;
             else $surcharge += $obj->surcharge;
         }//耗材附加费
+
         foreach ($obj->items as $rule){
+
             if ($result)$rule->unit_price = explode(",",$rule->discount_price)[key($result)]; //满足满减条件,单价调整为满减单价
 
             if ($rule->strategy=='起步'){
@@ -489,10 +491,8 @@ class OwnerPriceOperationService
                 }
             }
         }
-        if ($matchObject){
-            $money = $surcharge;
-            foreach ($matchObject as $package)if ($package["price"] ?? false)$money += $package[$columnMapping[8]] * $package["price"];
-        }
+        $money = $surcharge;
+        foreach ($matchObject as $mo)if ($mo["price"] ?? false)$money += $mo[$columnMapping[8]] * $mo["price"];
         return $money ?? -7;
     }
     //递归式重新设置数量