Song 滙入資料取時間資料正規化 20250509
This commit is contained in:
parent
8c59fced90
commit
e7772026ea
@ -48,7 +48,7 @@ class ImportSongChunkJob implements ShouldQueue
|
||||
$song = new Song([
|
||||
'id' => $songId,
|
||||
'name' => trim($row['歌名'] ?? ''),
|
||||
'adddate' => trim($row['日期'] ?? null),
|
||||
'adddate' => $this->parseExcelDate($row['日期'] ?? null),
|
||||
'filename' => trim($row['檔名'] ?? ''),
|
||||
'language_type' => SongLanguageType::tryFrom(trim($row['語別'] ?? '')) ?? SongLanguageType::Unset,
|
||||
'db_change' => trim($row['kk2'] ?? 0),//分貝增減
|
||||
@ -99,4 +99,19 @@ class ImportSongChunkJob implements ShouldQueue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function parseExcelDate($value): ?string
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
return \Carbon\Carbon::createFromFormat('Y-m-d', '1900-01-01')
|
||||
->addDays((int)$value - 2)
|
||||
->format('Y-m-d');
|
||||
}
|
||||
|
||||
try {
|
||||
return \Carbon\Carbon::parse($value)->format('Y-m-d');
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -65,7 +65,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
4
開發手冊.ini
4
開發手冊.ini
@ -94,10 +94,10 @@ php artisan make:observer RoomObserver --model=Room
|
||||
|
||||
|
||||
|
||||
|
||||
--memory=5120
|
||||
|
||||
php artisan queue:work --timeout=600 --memory=1024
|
||||
php artisan queue:work --daemon --timeout=3600 --memory=5120 --tries=1 --queue=default
|
||||
php artisan queue:work --daemon --timeout=3600 --tries=1 --queue=default
|
||||
|
||||
composer install
|
||||
cp .env.example .env
|
||||
|
Loading…
x
Reference in New Issue
Block a user