1
0

first commit

This commit is contained in:
2020-08-06 15:36:28 +08:00
commit fe5c11976c
12348 changed files with 1411979 additions and 0 deletions

32
app/Jobs/BaseJob.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class BaseJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* 队列名称,默认 [default]
* @var string|null
*/
public $queue;
/**
* 任务可以执行的秒数 (超时时间)。
* @var int
*/
public $timeout = 300;
/**
* 任务可以尝试的最大次数。
* @var int
*/
public $tries = 1;
}

33
app/Jobs/CloseOrder.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Jobs;
use App\Models\Order;
class CloseOrder extends BaseJob
{
public $queue;
protected $order;
/**
* 创建一个新的任务实例。
* @return void
*/
public function __construct(Order $order)
{
$this->order = $order;
}
/**
* 执行任务
* @return void
*/
public function handle()
{
if ($this->order->canCancel()) {
$this->order->cancel(4);
}
}
}