|
|
@@ -25,20 +25,14 @@ class LogisticQiaoSFService
|
|
|
*/
|
|
|
public function get($logisticNums): array
|
|
|
{
|
|
|
- $url = config('api_logistic.SF.url');
|
|
|
- $head = config('api_logistic.SF.head');
|
|
|
- $checkWord = config('api_logistic.SF.checkWord');
|
|
|
- $maxSize = config('api_logistic.SF.maxSize', 10);
|
|
|
-
|
|
|
// 将$logisticNums以10个位单位进行分割,返回二维数组
|
|
|
- $logisticNums_size_10 = array_chunk($logisticNums, $maxSize);
|
|
|
-
|
|
|
+ $logisticNums_size_10 = array_chunk($logisticNums, config('api_logistic.SF.max_size', 10));
|
|
|
// 遍历二维数组批量查询顺丰接口
|
|
|
//将查询到的结果整合到一起,更新order_packages.received_at
|
|
|
$result = [];
|
|
|
foreach ($logisticNums_size_10 as $numbers) {
|
|
|
$numbersStr = implode(',', $numbers);
|
|
|
- $result_10 = $this->getResultFromSF($head, $numbersStr, $checkWord, $url);
|
|
|
+ $result_10 = $this->getResultFromSF(config('api_logistic.SF.head'), $numbersStr, config('api_logistic.SF.check_word'), config('api_logistic.SF.url'));
|
|
|
$result = array_merge($result, $result_10);
|
|
|
}
|
|
|
return $result;
|
|
|
@@ -102,7 +96,7 @@ xml;
|
|
|
$data['logistic_number'] = $routeResponse['@attributes'][$this->protected_switch['logistic_number']];
|
|
|
foreach ($routeResponse['Route'] as $route) {
|
|
|
$route = get_object_vars($route)['@attributes'];
|
|
|
- if ($route['opcode'] == 50) {
|
|
|
+ if ($route['opcode'] == config('api_logistic.SF.received_code', 50)) {
|
|
|
$data['status'] = '已揽收';
|
|
|
$data['transfer_status'] = $route[$this->protected_switch['transfer_status']];
|
|
|
$data['received_at'] = $route[$this->protected_switch['received_at']];
|