diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index e24dd95..86819c1 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -2,6 +2,7 @@ namespace App\Console\Commands; +use App\Events\CreateLogisticEvent; use App\Events\StockUpdateEvent; use App\Exports\DiffTodayPriceGoodsExport; use App\Models\BusinessGoodsSku; diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 9eee939..1bb33f4 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -265,11 +265,22 @@ class KuaiTuanTuan extends BusinessClient public function createLogistic($orderSn, $waybillNo) { - return Order::createOrderLogistic($orderSn, $waybillNo); + [$type, $appendParams] = Order::createOrderLogistic($orderSn, $waybillNo); + + return $this->doRequest($type, $appendParams); } public function cancelLogistic($orderSn, $waybillNo) { - return Order::deleteOrderLogistic($orderSn, $waybillNo); + [$type, $appendParams] = Order::deleteOrderLogistic($orderSn, $waybillNo); + + return $this->doRequest($type, $appendParams); + } + + public function getLogisticsCompanies() + { + [$type, $appendParams] = Order::getLogisticsCompanies(); + + return $this->doRequest($type, $appendParams); } } diff --git a/app/Services/Business/KuaiTuanTuan/Order.php b/app/Services/Business/KuaiTuanTuan/Order.php index 71977c5..6d12091 100644 --- a/app/Services/Business/KuaiTuanTuan/Order.php +++ b/app/Services/Business/KuaiTuanTuan/Order.php @@ -58,7 +58,7 @@ class Order return [$type, $appendParams]; } - public function getLogisticsCompanies() + public static function getLogisticsCompanies() { $type = 'pdd.logistics.companies.get'; @@ -66,7 +66,7 @@ class Order } - public static function createOrderLogistic($orderSn, $waybillNo, $logisticsId = '', $logisticsName = '') + public static function createOrderLogistic($orderSn, $waybillNo, $logisticsId = 44, $logisticsName = '顺丰快递') { // 不支持拆单发货 $type = 'pdd.ktt.order.logistic.create'; diff --git a/app/Services/Ship/WayBillService.php b/app/Services/Ship/WayBillService.php index 1b4d811..1d60920 100644 --- a/app/Services/Ship/WayBillService.php +++ b/app/Services/Ship/WayBillService.php @@ -65,7 +65,7 @@ class WayBillService 'participate_no' => $waybill->participate_no, 'note' => $waybill->note, ]; - event(new CreateLogisticEvent($shopId, $waybill->order_sn, $data['waybill_code'])); + event(new CreateLogisticEvent($shopShip->shop_id, $waybill->order_sn, $data['waybill_code'])); } } else { $contents[$waybill->id] = [ @@ -116,13 +116,13 @@ class WayBillService return [$documents, $orderIds]; } - private function saveWayBill($order, $shop, $senderConfig) + private function saveWayBill($order, $shopShip, $senderConfig) { $waybill = Waybill::query()->firstOrNew( ['order_sn' => $order['order_sn']] ); - $waybill->shop_id = $shop->shop_id; + $waybill->shop_id = $shopShip->shop_id; $waybill->object_id = $this->objectId; $waybill->sender_country = $senderConfig['country']; @@ -140,7 +140,7 @@ class WayBillService $waybill->recipient_name = $order['recipient_name']; $waybill->recipient_mobile = $order['recipient_mobile']; - $waybill->user_id = $shop->owner_id; + $waybill->user_id = $shopShip->owner_id; $waybill->wp_code = $senderConfig['wp_code']; $waybill->order_sn = $order['order_sn']; $waybill->order_id = $order['id'];