31 lines
583 B
PHP
31 lines
583 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Events\OrderCreated;
|
|
use App\Jobs\CloseOrder;
|
|
|
|
class AutoCloseOrder
|
|
{
|
|
/**
|
|
* 创建事件监听器。
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* 处理事件。
|
|
* @param \App\Events\OrderCreated $event
|
|
* @return void
|
|
*/
|
|
public function handle(OrderCreated $event)
|
|
{
|
|
if (config('aslong_order.auto_cancel_order') > 0) {
|
|
CloseOrder::dispatch($event->order)->delay(now()->addMinutes(config('aslong_order.auto_cancel_order')));
|
|
}
|
|
}
|
|
}
|