mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
38 lines
808 B
PHP
38 lines
808 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Events\GroupSetEvent;
|
|
use App\Models\Groups;
|
|
use App\Models\Shop;
|
|
use App\Services\Business\BusinessFactory;
|
|
|
|
class GroupQueryListener
|
|
{
|
|
/**
|
|
* Create the event listener.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the event.
|
|
*
|
|
* @param GroupSetEvent $event
|
|
* @return void
|
|
*/
|
|
public function handle(GroupSetEvent $event)
|
|
{
|
|
$shopId = Groups::query()->where('id', $event->groupId)->value('shop_id');
|
|
$shop = Shop::query()->find($shopId);
|
|
$client = BusinessFactory::init()->make($shop['plat_id'])->setShop($shop);
|
|
$client->createGroup($event->groupId);
|
|
sleep(1);
|
|
$client->queryGroupStatus($event->groupId);
|
|
}
|
|
}
|