mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
commit
37c213e58d
@ -29,12 +29,12 @@ class WayBillService
|
||||
$contents = [];
|
||||
foreach ($this->orders as $shopId => $order) {
|
||||
// 订单取消的情况暂不处理
|
||||
$shop = $this->getShop($shopId);
|
||||
$shopShip = $this->getShopShip($shopId);
|
||||
$faceSheet = new FaceSheet();
|
||||
$faceSheet->setShop($shop);
|
||||
$faceSheet->setShop($shopShip);
|
||||
foreach ($order as $item) {
|
||||
[$sender, $orderInfo, $wpCode] = $this->prepareRequest($item, $shop);
|
||||
$waybill = $this->saveWayBill($item, $shop);
|
||||
[$sender, $orderInfo, $wpCode] = $this->prepareRequest($item, $shopShip);
|
||||
$waybill = $this->saveWayBill($item, $shopShip);
|
||||
|
||||
if (empty($waybill->id)) {
|
||||
$resp = $faceSheet->getWayBill($sender, $orderInfo, $wpCode);
|
||||
@ -150,7 +150,7 @@ class WayBillService
|
||||
return $waybill;
|
||||
}
|
||||
|
||||
private function timedDelivery($order)
|
||||
private function getTimedDelivery($orderItem)
|
||||
{
|
||||
$this->timedDeliveryCode = Waybill::$BUSINESS_EXPRESS_CODE;
|
||||
$address = [
|
||||
@ -166,20 +166,20 @@ class WayBillService
|
||||
'西宁市', '海东市', '海北藏族自治州', '黄南藏族自治州', '海南藏族自治州', '玉树藏族自治州'
|
||||
],
|
||||
];
|
||||
if (isset($address[$order['recipient_province']])) {
|
||||
if (empty($address[$order['recipient_province']])) {
|
||||
if (isset($address[$orderItem['recipient_province']])) {
|
||||
if (empty($address[$orderItem['recipient_province']])) {
|
||||
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
|
||||
}
|
||||
if ($address[$order['recipient_province']] && in_array($order['recipient_city'], $address[$order['recipient_province']], true)) {
|
||||
if ($address[$orderItem['recipient_province']] && in_array($orderItem['recipient_city'], $address[$orderItem['recipient_province']], true)) {
|
||||
$this->timedDeliveryCode = Waybill::$AIR_FREIGHT_CODE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function prepareRequest($order, $shop)
|
||||
private function prepareRequest($order, $shopShip)
|
||||
{
|
||||
$this->timedDelivery($order);
|
||||
$senderConfig = $shop->senders[0];
|
||||
$this->getTimedDelivery($order);
|
||||
$senderConfig = $shopShip->senders[0];
|
||||
$sender = [
|
||||
'address' => [
|
||||
'city' => $senderConfig['city'],
|
||||
@ -234,7 +234,7 @@ class WayBillService
|
||||
'mobile' => $order['recipient_mobile'],
|
||||
],
|
||||
'template_url' => $this->sfOne,
|
||||
'user_id' => $shop->owner_id,
|
||||
'user_id' => $shopShip->owner_id,
|
||||
];
|
||||
|
||||
return [$sender, $orderInfo, $senderConfig['wp_code']];
|
||||
@ -329,7 +329,7 @@ class WayBillService
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getShop($shopId)
|
||||
private function getShopShip($shopId)
|
||||
{
|
||||
return ShopShip::query()
|
||||
->select(['id', 'shop_id', 'access_token', 'owner_id'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user