Parcourir la source

顺丰询价接口参数测试与调整

shizhongqi il y a 7 mois
Parent
commit
a65b15810e

+ 1 - 2
common/components/delivery/platform/shunfeng/Shunfeng.php

@@ -29,13 +29,12 @@ class Shunfeng
             $this->baseUrl = 'https://openic.sf-express.com/open/api/external/';
             $this->devId = 1594082399;
             $this->appSecret = '9025c4f5ad93e8e08e947f02d0cde652';
-            $this->shopId = $shopId;
         } else {
             $this->baseUrl = 'https://openic.sf-express.com/open/api/external/';
             $this->devId = 1741530942;
             $this->appSecret = '07b3f83d19a4a9f89322976c936faf92';
-            $this->shopId = $shopId;
         }
+        $this->shopId = $shopId;
 
         //保存 xhDeliveryAuthToken 表数据
         $this->deliveryAuthToken = $deliveryAuthToken;

+ 16 - 13
common/components/delivery/services/DispatchService.php

@@ -309,18 +309,21 @@ class DispatchService
                 $adapter = $this->adapters['shunfeng'];
                 // is_person_direct -- 店铺是否支持专人直送,0不支持 1支持 2只能发独享专送
                 $isPersonDirect = $adapter->getIsPersonDirect();
-                if($isPersonDirect != 2){
-                    //$customSettings = $this->adapters['shunfeng']->getCustomSettings();
-                    $customSettings = [];//自定义用户设置:默认不专人直送
-                    $preparedData['shunfeng'] = $this->prepareShunfengData($order, $shop, $customSettings);
-                }
+                 if($isPersonDirect != 2){
+                     $customSettings = [];//自定义用户设置:默认不专人直送
+                     $preparedData['shunfeng'] = $this->prepareShunfengData($order, $shop, $customSettings);
+                 }
 
                 //添加专人直送的订单数据
-                if(in_array($isPersonDirect, [1, 2])){
+                if(in_array($isPersonDirect, [1, 2])){ // 支持专人直送
                     $customSettings = ['isPersonDirect' => 1];//自定义用户设置:专人直送
                     $preparedData['shunfeng_1v1'] = $this->prepareShunfengData($order, $shop, $customSettings);
                     Yii::info('预创建订单 shunfeng_1v1 request data: ' . json_encode($preparedData['shunfeng_1v1']));
                 }
+                // else{
+                //     $customSettings = [];//自定义用户设置:默认不专人直送
+                //     $preparedData['shunfeng'] = $this->prepareShunfengData($order, $shop, $customSettings);
+                // }
             } catch (\Exception $e) {
                 Yii::warning("Shunfeng 数据准备失败: {$e->getMessage()}");
             }
@@ -555,13 +558,13 @@ class DispatchService
             'product_type' => 4,                                     // 物品类型(4:鲜花绿植)
             'push_time' => time(),                                   // 推单时间(秒级时间戳)
             //shop 平台级开发者需要传入
-            'shop' => [                                              // 发货店铺信息
-                'shop_name' => $shop['merchantName'],                // 店铺名称
-                'shop_address' => $shop['fullAddress'],              // 店铺地址
-                'shop_lng' => (string)$shop['long'],                 // 店铺经度
-                'shop_lat' => (string)$shop['lat'],                  // 店铺纬度
-                'shop_phone' => $shop['mobile'],                     // 店铺联系电话
-            ],
+            // 'shop' => [                                              // 发货店铺信息
+            //     'shop_name' => $shop['merchantName'],                // 店铺名称
+            //     'shop_address' => $shop['fullAddress'],              // 店铺地址
+            //     'shop_lng' => (string)$shop['long'],                 // 店铺经度
+            //     'shop_lat' => (string)$shop['lat'],                  // 店铺纬度
+            //     'shop_phone' => $shop['mobile'],                     // 店铺联系电话
+            // ],
             //-------------------------- 非必填 -------------------------------
             'city_name' => $order['city'],                          // 发单城市
             //'order_source' => '6',                                   // 订单接入来源(6:京东秒送,可自定义)

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

@@ -439,7 +439,6 @@ class ShunfengAdapter extends Shunfeng implements Adapter
             'shop_id' => $this->shopId,
             'shop_type' => 1, //1:顺丰店铺ID 2:接入方店铺ID
         ];
-
         $payload = array_merge($payload, $data);
 
         // 计算签名(SignHelper 会自动递归过滤空值)