加入 執行記錄
202050509
This commit is contained in:
parent
d29f026ab1
commit
056b1eff73
@ -7,6 +7,7 @@ use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithChunkReading;
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Imports\HeadingRowFormatter;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Jobs\ImportArtistChunkJob;
|
||||
use App\Jobs\ImportSongChunkJob;
|
||||
|
||||
@ -20,12 +21,17 @@ class DataImport implements ToCollection, WithHeadingRow, WithChunkReading
|
||||
}
|
||||
public function collection(Collection $rows)
|
||||
{
|
||||
Log::warning('匯入啟動', [
|
||||
'model' => $this->modelName,
|
||||
'from_row' => $rows->keys()->first() + 2,
|
||||
'rows_count' => $rows->count()
|
||||
]);
|
||||
if($this->modelName=='Song'){
|
||||
ImportSongChunkJob::dispatch($rows);
|
||||
}else if($this->modelName=='Artist'){
|
||||
ImportArtistChunkJob::dispatch($rows);
|
||||
}else{
|
||||
|
||||
Log::warning('未知的 modelName', ['model' => $this->modelName]);
|
||||
}
|
||||
}
|
||||
public function chunkSize(): int
|
||||
|
BIN
storage/.DS_Store
vendored
BIN
storage/.DS_Store
vendored
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user