|
|
@@ -303,9 +303,6 @@ export default class PlaylistTable {
|
|
|
try {
|
|
|
Logger.info('PlaylistTable', `开始批量添加歌曲到歌单: playlistId=${playlistId}, 歌曲数量=${songFilePaths.length}`);
|
|
|
|
|
|
- // 开始事务
|
|
|
- await this.rdbStore.executeSql('BEGIN TRANSACTION');
|
|
|
-
|
|
|
let successCount = 0;
|
|
|
for (const songFilePath of songFilePaths) {
|
|
|
try {
|
|
|
@@ -323,14 +320,12 @@ export default class PlaylistTable {
|
|
|
|
|
|
await this.rdbStore.executeSql(sql, params);
|
|
|
successCount++;
|
|
|
+ Logger.info('PlaylistTable', `成功添加歌曲: ${songFilePath}`);
|
|
|
} catch (error) {
|
|
|
Logger.error('PlaylistTable', `添加歌曲失败: ${songFilePath}, 错误: ${error.message}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 提交事务
|
|
|
- await this.rdbStore.executeSql('COMMIT');
|
|
|
-
|
|
|
// 更新歌单歌曲数量
|
|
|
Logger.info('PlaylistTable', '开始更新歌单歌曲数量');
|
|
|
await this.updatePlaylistSongCount(playlistId);
|
|
|
@@ -338,13 +333,6 @@ export default class PlaylistTable {
|
|
|
Logger.info('PlaylistTable', `批量添加歌曲完成,成功添加 ${successCount} 首,共 ${songFilePaths.length} 首`);
|
|
|
return successCount > 0;
|
|
|
} catch (error) {
|
|
|
- // 回滚事务
|
|
|
- try {
|
|
|
- await this.rdbStore.executeSql('ROLLBACK');
|
|
|
- } catch (rollbackError) {
|
|
|
- Logger.error('PlaylistTable', `事务回滚失败: ${rollbackError.message}`);
|
|
|
- }
|
|
|
-
|
|
|
Logger.error('PlaylistTable', `批量添加歌曲到歌单失败: ${error.message}`);
|
|
|
return false;
|
|
|
}
|