erp/app/Listeners/CreateLogisticListener.php
2024-12-28 15:32:20 +08:00

37 lines
828 B
PHP

<?php
namespace App\Listeners;
use App\Events\CreateLogisticEvent;
use App\Models\BusinessOrder;
use App\Models\Shop;
use App\Services\Business\BusinessFactory;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class CreateLogisticListener implements ShouldQueue
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param CreateLogisticEvent $event
* @return void
*/
public function handle(CreateLogisticEvent $event)
{
$shop = Shop::query()->findOrFail($event->shopId);;
$client = BusinessFactory::init()->make($shop['plat_id'])->setShop($shop);
$client->createLogistic($event->orderSn, $event->waybillNo);
}
}