Browse Source

1.零售发跑腿,收件人号码为空bug修复 2.修复各平台估价请求产生的错误没正常返回的bug

shizhongqi 8 months ago
parent
commit
5e463198d9

+ 4 - 4
common/components/delivery/services/DispatchService.php

@@ -303,7 +303,7 @@ class DispatchService
                         'district_name' => $order['dist'],
                         'house_number' => $order['floor'],
                         'contacts_name' => $order['customName'],
-                        'contacts_phone_no' => isset($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile']) ? $order['receiveMobile'] : '',
+                        'contacts_phone_no' => isset($order['customMobile'])&&!empty($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile'])&&!empty($order['receiveMobile']) ? $order['receiveMobile'] : $order['bookMobile'],
                         'lat_lon' => ['lat' => (float)$order['lat'], 'lon' => (float)$order['long']],
                     ]
                 ],
@@ -347,7 +347,7 @@ class DispatchService
         return [
             'platform' => 'fengniao',
             'partner_order_code' => $order['orderSn'],
-            'receiver_primary_phone' => isset($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile']) ? $order['receiveMobile'] : '',
+            'receiver_primary_phone' => isset($order['customMobile'])&&!empty($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile'])&&!empty($order['receiveMobile']) ? $order['receiveMobile'] : $order['bookMobile'],
             'receiver_name' => $order['customName'],
             'receiver_latitude' => (float)$order['lat'],
             'receiver_longitude' => (float)$order['long'],
@@ -386,7 +386,7 @@ class DispatchService
                     'toAddress' => $order['address'],
                     'toAddressDetail' => $order['floor'],
                     'toReceiverName' => $order['customName'],
-                    'toMobile' => isset($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile']) ? $order['receiveMobile'] : '',
+                    'toMobile' => isset($order['customMobile'])&&!empty($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile'])&&!empty($order['receiveMobile']) ? $order['receiveMobile'] : $order['bookMobile'],
                     'toLatitude' => (float)$order['lat'],
                     'toLongitude' => (float)$order['long'],
                     'goodType' => 7,
@@ -493,7 +493,7 @@ class DispatchService
             'receiver_lng' => (float)$order['long'],
             'callback' => $callbackUrl,
             'cargo_weight' => isset($order['weight']) ? (float)$order['weight'] : 1.0,
-            'receiver_phone' => isset($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile']) ? $order['receiveMobile'] : '',
+            'receiver_phone' => isset($order['customMobile'])&&!empty($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile'])&&!empty($order['receiveMobile']) ? $order['receiveMobile'] : $order['bookMobile'],
             'tips' => 0,
             'info' => $order['remark'] ?? '',
             'product_list' => $productList,

+ 7 - 2
common/components/delivery/services/adapter/FengniaoAdapter.php

@@ -101,7 +101,7 @@ class FengniaoAdapter extends Fengniao implements Adapter
         $orderData = [
             //'out_shop_code' => $params['mainId'], // 当使用门店发单 out_shop_code 和 chain_store_id 必填1个
             'partner_order_code' => $order['orderSn'],
-            'receiver_primary_phone' => isset($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile']) ? $order['receiveMobile'] : '',
+            'receiver_primary_phone' => isset($order['customMobile'])&&!empty($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile'])&&!empty($order['receiveMobile']) ? $order['receiveMobile'] : $order['bookMobile'],
             'receiver_name' => $order['customName'],
             'receiver_latitude' => (float)$order['lat'],
             'receiver_longitude' => (float)$order['long'],
@@ -596,7 +596,12 @@ class FengniaoAdapter extends Fengniao implements Adapter
             ];
         }
 
-        return null;
+        Yii::error('fengniao 报价失败:'.json_encode($resp));
+        return [
+            'platform' => 'fengniao',
+            'code' => $resp['code'],
+            'error' => $resp['msg']
+        ];
     }
 
     /**

+ 7 - 2
common/components/delivery/services/adapter/HuolalaAdapter.php

@@ -222,7 +222,7 @@ class HuolalaAdapter extends Huolala implements Adapter
                      'district_name' => $order['dist'],
                      'house_number' => $order['floor'],
                      'contacts_name' => $order['customName'],
-                     'contacts_phone_no' => isset($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile']) ? $order['receiveMobile'] : '',
+                     'contacts_phone_no' => isset($order['customMobile'])&&!empty($order['customMobile']) ? $order['customMobile'] : isset($order['receiveMobile'])&&!empty($order['receiveMobile']) ? $order['receiveMobile'] : $order['bookMobile'],
                  ]
             ],
             'vehicle_std' => $params['vehicle_std'],
@@ -531,7 +531,12 @@ class HuolalaAdapter extends Huolala implements Adapter
         if (isset($resp['ret']) && $resp['ret'] == 0 && isset($resp['data'])) {
             return $resp['data'];
         }
-        return null;
+
+        Yii::error('huolala 报价失败:'.json_encode($resp));
+        return [
+            'platform' => 'huolala',
+            'error' => isset($resp['msg']) ? $resp['msg'] : 'fail'
+        ];
     }
 
     /**

+ 6 - 1
common/components/delivery/services/adapter/ShansongAdapter.php

@@ -212,7 +212,12 @@ class ShansongAdapter extends Shansong implements Adapter
             ];
         }
 
-        return null;
+        Yii::error('shansong 报价失败:'.json_encode($resp));
+        return [
+            'platform' => 'shansong',
+            'status' => $resp['status'],
+            'error' => $resp['msg'],
+        ];
     }
 
     /**

+ 2 - 1
common/components/delivery/services/adapter/ShunfengAdapter.php

@@ -358,9 +358,10 @@ class ShunfengAdapter extends Shunfeng implements Adapter
                 // 还有其它返回值没加进来,TODO
             ];
         } else {
+            Yii::error('shunfeng 报价失败:'.json_encode($resp));
             return [
                 'platform' => 'shunfeng',
-                'error' => $resp['error_msg'],
+                'error' => isset($resp['error_msg']) ? $resp['error_msg'] : '',
             ];
         }
     }