فهرست منبع

Merge branch 'zhongqi-delivery' into dev

shizhongqi 8 ماه پیش
والد
کامیت
fa09fbe213
2فایلهای تغییر یافته به همراه16 افزوده شده و 18 حذف شده
  1. 4 3
      app-ghs/controllers/DeliveryController.php
  2. 12 15
      common/components/delivery/services/DispatchService.php

+ 4 - 3
app-ghs/controllers/DeliveryController.php

@@ -247,15 +247,17 @@ class DeliveryController extends BaseController
     {
     {
         $post = Yii::$app->request->post();
         $post = Yii::$app->request->post();
         $orderTime = $post['pickupTime'];
         $orderTime = $post['pickupTime'];
-        //$remark = $post['remark'];
+        $weight = $post['weight'];
+        $remark = $post['remark'] ?? '';
 
 
         $adminId = $this->adminId;
         $adminId = $this->adminId;
         util::checkRepeatCommit($adminId, 4);
         util::checkRepeatCommit($adminId, 4);
 
 
         $orderId = intval($post['orderId']);
         $orderId = intval($post['orderId']);
         $order = OrderClass::getById($orderId);
         $order = OrderClass::getById($orderId);
-        //$order['remark'] = $remark; // 把备注信息写入
         $shop = ShopClass::getById($this->shopId);
         $shop = ShopClass::getById($this->shopId);
+        $order['weight'] = $weight;
+        $order['remark'] = $remark;
 
 
         $ds = new DispatchService($this->mainId);
         $ds = new DispatchService($this->mainId);
         $platformQuotes = $ds->getAllPlatformPrice($order, $shop, $orderTime);
         $platformQuotes = $ds->getAllPlatformPrice($order, $shop, $orderTime);
@@ -279,7 +281,6 @@ class DeliveryController extends BaseController
         $form->loadAndValidate();
         $form->loadAndValidate();
 
 
         $post = $form->getAttributes();
         $post = $form->getAttributes();
-        //$post = Yii::$app->request->post();
         $orderId = $post['orderId']; // xhGhsOrder.id
         $orderId = $post['orderId']; // xhGhsOrder.id
         $params = $post['allParams'];
         $params = $post['allParams'];
         $platform = $params['en_name'];// $post['platform'] 是中文
         $platform = $params['en_name'];// $post['platform'] 是中文

+ 12 - 15
common/components/delivery/services/DispatchService.php

@@ -387,30 +387,27 @@ class DispatchService
     private function prepareShunfengData($order, $shop)
     private function prepareShunfengData($order, $shop)
     {
     {
         // 获取订单商品信息
         // 获取订单商品信息
-        $itemInfos = OrderItemClass::getAllByCondition(['orderSn' => $order['orderSn']], null, 'id, name, unitPrice, num, unitWeight');
-        
+        // $itemInfos = OrderItemClass::getAllByCondition(['orderSn' => $order['orderSn']], null, 'id, name, unitPrice, num, unitWeight');
         // 计算商品总重量(单位:克)
         // 计算商品总重量(单位:克)
-        $totalWeight = 0;
-        foreach ($itemInfos as $item) {
-            $totalWeight += (int)($item['unitWeight'] * $item['num']) * 1000;
-        }
-        
+        // $totalWeight = 0;
+        // foreach ($itemInfos as $item) {
+        //     $totalWeight += (int)($item['unitWeight'] * $item['num']) * 1000;
+        // }
         // 如果没有商品重量,使用订单重量
         // 如果没有商品重量,使用订单重量
-        if ($totalWeight == 0 && isset($order['weight'])) {
-            $totalWeight = (int)$order['weight'] * 1000;
-        }
-        
+        // if ($totalWeight == 0 && isset($order['weight'])) {
+        //     $totalWeight = (int)$order['weight'] * 1000;
+        // }
         // 默认重量为1000克(1公斤)
         // 默认重量为1000克(1公斤)
-        if ($totalWeight == 0) {
-            $totalWeight = 1000;
-        }
+        // if ($totalWeight == 0) {
+        //     $totalWeight = 1000;
+        // }
 
 
         return [
         return [
             'platform' => 'shunfeng',
             'platform' => 'shunfeng',
             'user_lng' => (string)$order['long'],                    // 用户地址经度
             'user_lng' => (string)$order['long'],                    // 用户地址经度
             'user_lat' => (string)$order['lat'],                     // 用户地址纬度
             'user_lat' => (string)$order['lat'],                     // 用户地址纬度
             'user_address' => $order['fullAddress'],                 // 用户详细地址
             'user_address' => $order['fullAddress'],                 // 用户详细地址
-            'weight' => $totalWeight,                                // 物品重量(单位:克)
+            'weight' => $order['weight'],                            // 物品重量(单位:克)
             'product_type' => 4,                                     // 物品类型(4:鲜花绿植)
             'product_type' => 4,                                     // 物品类型(4:鲜花绿植)
             'push_time' => time(),                                   // 推单时间(秒级时间戳)
             'push_time' => time(),                                   // 推单时间(秒级时间戳)
             'shop' => [                                              // 发货店铺信息
             'shop' => [                                              // 发货店铺信息