Merge pull request !203 from 赵世界/bugfix/2023-08-25
This commit is contained in:
赵世界 2023-08-28 09:08:58 +00:00 committed by Gitee
commit 27e6d329cc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -34,11 +34,11 @@ class WayBillService
$faceSheet = new FaceSheet(); $faceSheet = new FaceSheet();
$faceSheet->setShop($shopShip); $faceSheet->setShop($shopShip);
foreach ($order as $item) { foreach ($order as $item) {
[$sender, $orderInfo, $wpCode] = $this->prepareRequest($item, $shopShip); [$sender, $orderInfo, $senderConfig] = $this->prepareRequest($item, $shopShip);
$waybill = $this->saveWayBill($item, $shopShip, $sender); $waybill = $this->saveWayBill($item, $shopShip, $senderConfig);
if (empty($waybill->id)) { if (empty($waybill->id)) {
$resp = $faceSheet->getWayBill($sender, $orderInfo, $wpCode); $resp = $faceSheet->getWayBill($sender, $orderInfo, $senderConfig['wp_code']);
if (isset($resp['pdd_waybill_get_response'])) { if (isset($resp['pdd_waybill_get_response'])) {
$data = $resp['pdd_waybill_get_response']['modules'][0]; $data = $resp['pdd_waybill_get_response']['modules'][0];
$printData = json_decode($data['print_data'], true); $printData = json_decode($data['print_data'], true);
@ -151,7 +151,7 @@ class WayBillService
return $waybill; return $waybill;
} }
private function getTimedDelivery($orderItem) private function getTimedDelivery($order)
{ {
$this->timedDeliveryCode = Waybill::$BUSINESS_EXPRESS_CODE; $this->timedDeliveryCode = Waybill::$BUSINESS_EXPRESS_CODE;
$address = [ $address = [
@ -167,11 +167,11 @@ class WayBillService
'西宁市', '海东市', '海北藏族自治州', '黄南藏族自治州', '海南藏族自治州', '玉树藏族自治州' '西宁市', '海东市', '海北藏族自治州', '黄南藏族自治州', '海南藏族自治州', '玉树藏族自治州'
], ],
]; ];
if (isset($address[$orderItem['recipient_province']])) { if (isset($address[$order['recipient_province']])) {
if (empty($address[$orderItem['recipient_province']])) { if (empty($address[$order['recipient_province']])) {
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE; $this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
} }
if ($address[$orderItem['recipient_province']] && in_array($orderItem['recipient_city'], $address[$orderItem['recipient_province']], true)) { if ($address[$order['recipient_province']] && in_array($order['recipient_city'], $address[$order['recipient_province']], true)) {
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE; $this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
} }
} }
@ -249,7 +249,7 @@ class WayBillService
'user_id' => $shopShip->owner_id, 'user_id' => $shopShip->owner_id,
]; ];
return [$senderConfig, $orderInfo, $senderConfig['wp_code']]; return [$sender, $orderInfo, $senderConfig];
} }
public function setObjectId() public function setObjectId()