音乐数据导入导出

This commit is contained in:
mtvpls
2026-02-02 14:27:25 +08:00
parent 68b1332df1
commit a447a41920
3 changed files with 72 additions and 0 deletions
+19
View File
@@ -865,6 +865,25 @@ export abstract class BaseRedisStorage implements IStorage {
if (skipConfigKeys.length > 0) {
await this.withRetry(() => this.adapter.del(skipConfigKeys));
}
// 删除音乐播放记录
await this.withRetry(() => this.adapter.del(this.musicPlayRecordHashKey(userName)));
// 删除用户的所有歌单
const playlistIds = await this.withRetry(() =>
this.adapter.zRange(this.musicPlaylistsKey(userName), 0, -1)
);
if (playlistIds && playlistIds.length > 0) {
for (const playlistId of playlistIds) {
const id = ensureString(playlistId);
// 删除歌单信息
await this.withRetry(() => this.adapter.del(this.musicPlaylistKey(id)));
// 删除歌单的歌曲列表
await this.withRetry(() => this.adapter.del(this.musicPlaylistSongsKey(id)));
}
}
// 删除用户的歌单列表
await this.withRetry(() => this.adapter.del(this.musicPlaylistsKey(userName)));
}
// ---------- 新版用户存储(使用Hash和Sorted Set ----------