فهرست منبع

DeliveryQuoteUtil.php 代码还原,简化代码

shizhongqi 9 ماه پیش
والد
کامیت
799a9fba74
2فایلهای تغییر یافته به همراه4 افزوده شده و 11 حذف شده
  1. 0 1
      app-mall/controllers/OrderController.php
  2. 4 10
      common/components/delivery/util/DeliveryQuoteUtil.php

+ 0 - 1
app-mall/controllers/OrderController.php

@@ -380,7 +380,6 @@ class OrderController extends BaseController
 
                 $prefix = 'XSD_CS-' . $this->mainId . '-';
                 $orderSn = $prefix . round(microtime(true) * 1000);
-
                 $ghsInfo = ['mainId' => $this->mainId, 'shopId' => $this->shopId];
 
                 // 这儿要调用跑腿接口计算运费和距离

+ 4 - 10
common/components/delivery/util/DeliveryQuoteUtil.php

@@ -109,15 +109,15 @@ class DeliveryQuoteUtil
         $sendDistance = $result['distance'] ?? 0;
 
         // 11. 应用免费配送规则
-        if(isset($order['freightType']) && $order['freightType'] == 0) {
+        if(isset($params['order']['freightType']) && $params['order']['freightType'] == 0) { //用于处理及区分花束订单是否部分免跑腿费,还是完全收取跑腿费
             $finalSendCost= $sendCost;
         }else{
             $finalSendCost = self::applyFreeDeliveryRules(
                 $sendCost,
                 $sendDistance,
                 $params['ghsInfo']['shopId'],
-                $params['productCount'] ?? 0,
-                $params['order']['itemTotalAmount'] ?? 0,
+                $params['productCount'],
+                $params['order']['itemTotalAmount'],
                 $params['ghsInfo']['mainId'],
                 $order['orderSn'],
                 $order['goodsType']
@@ -165,7 +165,7 @@ class DeliveryQuoteUtil
         $custom = $params['custom'];
         $orderInfo = $params['order'];
 
-        $order = [
+        return [
             'orderSn' => $orderInfo['orderSn'],
             'customName' => $custom->name,
             'customMobile' => $custom->mobile,
@@ -182,12 +182,6 @@ class DeliveryQuoteUtil
             'actPrice' => $orderInfo['itemTotalAmount'] ?? 0,
             'goodsType' => $orderInfo['goodsType'],
         ];
-
-        if(isset($orderInfo['freightType'])){
-            $order['freightType'] = $orderInfo['freightType'];
-        }
-
-        return $order;
     }
 
     /**