123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Jobs;
- use App\Models\DepositOrder;
- use App\Models\RentOrder;
- use Carbon\Carbon;
- use Illuminate\Database\Eloquent\Model;
- class CloseRentOrderJob extends Job
- {
- protected $model = '';
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct(Model $model, Carbon $delay)
- {
- $this->model = $model;
- // 设置延迟的时间,delay() 方法的参数代表多少秒之后执行
- $this->delay($delay);
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- if ((int)$this->model->rent_pay_status === RentOrder::PAY_STATUS_OK) {
- return;
- }
- $this->model->delete();
- }
- }
|