mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
40 lines
868 B
PHP
40 lines
868 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Listeners;
|
||
|
|
|
||
|
|
use App\Events\CreateLogisticEvent;
|
||
|
|
use App\Models\Shop;
|
||
|
|
use App\Services\Business\BusinessFactory;
|
||
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
|
use Illuminate\Queue\InteractsWithQueue;
|
||
|
|
|
||
|
|
class CreateLogisticListener implements ShouldQueue
|
||
|
|
{
|
||
|
|
public $connection = 'redis';
|
||
|
|
|
||
|
|
public $queue = 'listeners';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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);
|
||
|
|
}
|
||
|
|
}
|