42 lines
888 B
PHP
42 lines
888 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\ImportJob as ImportJobModel;
|
|
use Illuminate\Bus\Queueable;
|
|
use App\Admin\Services\ImportService;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
class ImportJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected $importJob;
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(ImportJobModel $job)
|
|
{
|
|
//
|
|
$this->importJob = $job;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
if(env('APP_DEBUG')){
|
|
\Log::info('执行文件导入');
|
|
}
|
|
(new ImportService())->import($this->importJob);
|
|
}
|
|
}
|