diff --git a/app/Services/Ship/WayBillService.php b/app/Services/Ship/WayBillService.php index d8a86f0..1b4d811 100644 --- a/app/Services/Ship/WayBillService.php +++ b/app/Services/Ship/WayBillService.php @@ -34,11 +34,11 @@ class WayBillService $faceSheet = new FaceSheet(); $faceSheet->setShop($shopShip); foreach ($order as $item) { - [$sender, $orderInfo, $wpCode] = $this->prepareRequest($item, $shopShip); - $waybill = $this->saveWayBill($item, $shopShip, $sender); + [$sender, $orderInfo, $senderConfig] = $this->prepareRequest($item, $shopShip); + $waybill = $this->saveWayBill($item, $shopShip, $senderConfig); 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'])) { $data = $resp['pdd_waybill_get_response']['modules'][0]; $printData = json_decode($data['print_data'], true); @@ -151,7 +151,7 @@ class WayBillService return $waybill; } - private function getTimedDelivery($orderItem) + private function getTimedDelivery($order) { $this->timedDeliveryCode = Waybill::$BUSINESS_EXPRESS_CODE; $address = [ @@ -167,11 +167,11 @@ class WayBillService '西宁市', '海东市', '海北藏族自治州', '黄南藏族自治州', '海南藏族自治州', '玉树藏族自治州' ], ]; - if (isset($address[$orderItem['recipient_province']])) { - if (empty($address[$orderItem['recipient_province']])) { + if (isset($address[$order['recipient_province']])) { + if (empty($address[$order['recipient_province']])) { $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; } } @@ -249,7 +249,7 @@ class WayBillService 'user_id' => $shopShip->owner_id, ]; - return [$senderConfig, $orderInfo, $senderConfig['wp_code']]; + return [$sender, $orderInfo, $senderConfig]; } public function setObjectId()