滙入資料 歌曲 英文 改 英語
滙入資料 歌曲 filename 補上路徑 但沒有設備名稱 20250520
This commit is contained in:
parent
f446a64664
commit
8cc08e851b
@ -35,4 +35,22 @@ enum SongLanguageType: string
|
||||
self::Other => __('enums.song.LanguageType.Other'),
|
||||
};
|
||||
}
|
||||
public static function fromLabelOrName(string $input): self
|
||||
{
|
||||
$aliasMap = [
|
||||
'英文' => '英語',
|
||||
'華語' => '國語',
|
||||
'普通話' => '國語',
|
||||
'台灣話' => '台語',
|
||||
'客家話' => '客語',
|
||||
];
|
||||
// 將別名轉為正式值
|
||||
$input = $aliasMap[$input] ?? $input;
|
||||
foreach (self::cases() as $case) {
|
||||
if ($case->value === $input || $case->name === $input) {
|
||||
return $case;
|
||||
}
|
||||
}
|
||||
return self::Unset;
|
||||
}
|
||||
}
|
@ -43,6 +43,17 @@ class ImportSongChunkJob implements ShouldQueue
|
||||
$ToInsert = [];
|
||||
$artistMap = [];
|
||||
$categoryMap = [];
|
||||
$pMap = [
|
||||
'\\\\SVR01\\DISK01\\' => 'DISK01\\',
|
||||
'\\\\SVR01\\DISK02\\' => 'DISK02\\',
|
||||
'\\\\SVR01\\DISK03\\' => 'DISK03\\',
|
||||
'\\\\SVR01\\DISK04\\' => 'DISK04\\',
|
||||
'\\\\SVR01\\DISK05\\' => 'DISK05\\',
|
||||
'\\\\SVR01\\DISK06\\' => 'DISK06\\',
|
||||
'\\\\SVR01\\DISK07\\' => 'DISK07\\',
|
||||
'\\\\SVR01\\DISK08\\' => 'DISK08\\',
|
||||
'\\\\SVR01\\DISK09\\' => 'DISK09\\',
|
||||
];
|
||||
foreach ($this->rows as $index => $row) {
|
||||
$songId = trim($row['編號'] ?? '');
|
||||
|
||||
@ -76,13 +87,17 @@ class ImportSongChunkJob implements ShouldQueue
|
||||
} else {
|
||||
$songNumber=trim($row['kk4'] ?? 0);
|
||||
}
|
||||
$pathKey = trim($row['路徑01'] ?? '');
|
||||
$disk = $pMap[$pathKey] ?? '';
|
||||
$filename = trim($row['檔名'] ?? '');
|
||||
// 準備 song 資料
|
||||
$ToInsert[] = [
|
||||
'id' => $songId,
|
||||
'name' => $this->formatText($row['歌名']),
|
||||
'adddate' => $this->parseExcelDate($row['日期'] ?? null),
|
||||
'filename' => trim($row['檔名'] ?? ''),
|
||||
'language_type' => SongLanguageType::tryFrom(trim($row['語別'] ?? '')) ?? SongLanguageType::Unset,
|
||||
'filename' => $disk . $filename,
|
||||
//'language_type' => SongLanguageType::tryFrom(trim($row['語別'] ?? '')) ?? SongLanguageType::Unset,
|
||||
'language_type' => SongLanguageType::fromLabelOrName($row['語別'] ?? ''),
|
||||
'db_change' => trim($row['kk2'] ?? 0),//分貝增減
|
||||
'vocal' => trim($row['kk6'] ?? 0),//人聲
|
||||
'situation' => SongSituation::tryFrom(trim($row['kk7'] ?? '')) ?? SongSituation::Unset,//情境
|
||||
|
@ -36,6 +36,16 @@
|
||||
<td class="border border-gray-300 px-3 py-1">可填入歌手名稱</td>
|
||||
<td class="border border-gray-300 px-3 py-1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="border border-gray-300 px-3 py-1">路徑01</td>
|
||||
<td class="border border-gray-300 px-3 py-1">歌曲路徑</td>
|
||||
<td class="border border-gray-300 px-3 py-1">\\SVR01\DISK01\</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="border border-gray-300 px-3 py-1">路徑02</td>
|
||||
<td class="border border-gray-300 px-3 py-1">歌曲路徑</td>
|
||||
<td class="border border-gray-300 px-3 py-1">\\SVR02\DISK01\</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="border border-gray-300 px-3 py-1">檔名</td>
|
||||
<td class="border border-gray-300 px-3 py-1">歌曲檔名</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user