mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-21 22:07:23 +08:00
feat: 逐字歌词
This commit is contained in:
@@ -65,7 +65,7 @@ export const getMusicLrc = async (id: number) => {
|
||||
}
|
||||
|
||||
// 获取新的歌词数据
|
||||
const res = await request.get<ILyric>('/lyric', { params: { id } });
|
||||
const res = await request.get<ILyric>('/lyric/new', { params: { id } });
|
||||
|
||||
// 只有在成功获取新数据后才删除旧缓存并添加新缓存
|
||||
if (res?.data) {
|
||||
|
||||
@@ -90,10 +90,11 @@ export class CacheManager {
|
||||
musicSources?: string[]
|
||||
): Promise<void> {
|
||||
try {
|
||||
// 深度克隆数据,确保可以被 IndexedDB 存储
|
||||
await saveData('music_url_cache', {
|
||||
id,
|
||||
data: result,
|
||||
musicSources: musicSources || [],
|
||||
data: cloneDeep(result),
|
||||
musicSources: cloneDeep(musicSources || []),
|
||||
createTime: Date.now()
|
||||
});
|
||||
console.log(`缓存音乐URL成功: ${id}`);
|
||||
|
||||
Reference in New Issue
Block a user