2022-09-03 05:22:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
|
|
|
use App\Models\User\Task;
|
|
|
|
use Illuminate\Bus\Queueable;
|
2022-09-08 16:12:02 +00:00
|
|
|
// use Illuminate\Contracts\Queue\ShouldBeUnique;
|
2022-09-03 05:22:40 +00:00
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
2022-09-08 16:12:02 +00:00
|
|
|
|
2022-09-03 05:22:40 +00:00
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
|
|
class ClearTasks implements ShouldQueue
|
|
|
|
{
|
2022-09-08 16:12:02 +00:00
|
|
|
use InteractsWithQueue, Queueable, SerializesModels;
|
2022-09-03 05:22:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new job instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the job.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
|
|
|
|
// 删除所有状态不为 pending 的任务
|
|
|
|
Task::where('status', '!=', 'pending')->delete();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|