|
@@ -1,8 +1,9 @@
|
|
|
<?php
|
|
<?php
|
|
|
namespace common\components\delivery\platform\fengniao;
|
|
namespace common\components\delivery\platform\fengniao;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+use Yii;
|
|
|
use common\components\delivery\helpers\HttpClient;
|
|
use common\components\delivery\helpers\HttpClient;
|
|
|
|
|
+use bizGhs\express\classes\DeliveryAuthTokenClass;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Class Shop
|
|
* Class Shop
|
|
@@ -37,7 +38,7 @@ class Shop extends Fengniao
|
|
|
public function chainstoreQueryList($data = [])
|
|
public function chainstoreQueryList($data = [])
|
|
|
{
|
|
{
|
|
|
// 验证 merchant_id 必填
|
|
// 验证 merchant_id 必填
|
|
|
- $merchantId = $data['merchant_id'] ?? null;
|
|
|
|
|
|
|
+ $merchantId = $data['merchant_id'] ?? $this->merchantId;
|
|
|
|
|
|
|
|
if (empty($merchantId)) {
|
|
if (empty($merchantId)) {
|
|
|
Yii::warning("[FengniaoAdapter] chainstoreQueryList failed: merchant_id is required");
|
|
Yii::warning("[FengniaoAdapter] chainstoreQueryList failed: merchant_id is required");
|
|
@@ -47,7 +48,7 @@ class Shop extends Fengniao
|
|
|
'data' => null
|
|
'data' => null
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
- $this->setMerchantId($merchantId);
|
|
|
|
|
|
|
+ //$this->setMerchantId($merchantId);
|
|
|
|
|
|
|
|
// 构建业务数据
|
|
// 构建业务数据
|
|
|
$businessData = [];
|
|
$businessData = [];
|
|
@@ -56,6 +57,7 @@ class Shop extends Fengniao
|
|
|
if (isset($data['page_no']) && $data['page_no'] !== null) {
|
|
if (isset($data['page_no']) && $data['page_no'] !== null) {
|
|
|
$businessData['page_no'] = (int)$data['page_no'];
|
|
$businessData['page_no'] = (int)$data['page_no'];
|
|
|
}
|
|
}
|
|
|
|
|
+ $businessData['page_size'] = 1000; // 设置每页获取数为 1000
|
|
|
if (isset($data['page_size']) && $data['page_size'] !== null) {
|
|
if (isset($data['page_size']) && $data['page_size'] !== null) {
|
|
|
$businessData['page_size'] = (int)$data['page_size'];
|
|
$businessData['page_size'] = (int)$data['page_size'];
|
|
|
}
|
|
}
|
|
@@ -69,8 +71,6 @@ class Shop extends Fengniao
|
|
|
'Content-Type' => 'application/json',
|
|
'Content-Type' => 'application/json',
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
- Yii::info("[FengniaoAdapter] chainstoreQueryList Response: " . json_encode($resp));
|
|
|
|
|
-
|
|
|
|
|
// 处理响应
|
|
// 处理响应
|
|
|
if (isset($resp['code']) && $resp['code'] == '200' && isset($resp['business_data'])) {
|
|
if (isset($resp['code']) && $resp['code'] == '200' && isset($resp['business_data'])) {
|
|
|
// business_data 是 JSON 字符串,需要解析
|
|
// business_data 是 JSON 字符串,需要解析
|
|
@@ -128,4 +128,28 @@ class Shop extends Fengniao
|
|
|
'data' => null
|
|
'data' => null
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function bindStore($mainId, $storeId)
|
|
|
|
|
+ {
|
|
|
|
|
+ $deliveryAuthToken = DeliveryAuthTokenClass::getByCondition(['platform'=>'fengniao', 'mainId'=>$mainId], true);
|
|
|
|
|
+ if(!$deliveryAuthToken){
|
|
|
|
|
+ Yii::error('蜂鸟平台未授权');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $deliveryAuthToken->shopId = $storeId;
|
|
|
|
|
+ $deliveryAuthToken->save();
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function unbindStore($mainId, $storeId)
|
|
|
|
|
+ {
|
|
|
|
|
+ $deliveryAuthToken = DeliveryAuthTokenClass::getByCondition(['platform'=>'fengniao', 'mainId'=>$mainId], true);
|
|
|
|
|
+ if(!$deliveryAuthToken){
|
|
|
|
|
+ Yii::error('蜂鸟平台未授权');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $deliveryAuthToken->shopId = '';
|
|
|
|
|
+ $deliveryAuthToken->save();
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|