修复关系型数据库保存音乐记录错误,播放记录修改为队列式
This commit is contained in:
+3
-2
@@ -748,7 +748,8 @@ export class D1Storage implements IStorage {
|
||||
async listMusicV2History(userName: string): Promise<MusicV2HistoryRecord[]> {
|
||||
try {
|
||||
const results = await this.db
|
||||
.prepare('SELECT * FROM music_v2_history WHERE username = ? ORDER BY last_played_at DESC')
|
||||
// 按队列顺序返回;当前播放项由最大 last_played_at 决定
|
||||
.prepare('SELECT * FROM music_v2_history WHERE username = ? ORDER BY created_at ASC, last_played_at ASC')
|
||||
.bind(userName)
|
||||
.all();
|
||||
|
||||
@@ -785,7 +786,7 @@ export class D1Storage implements IStorage {
|
||||
username, song_id, source, songmid, name, artist, album, cover, duration_text, duration_sec,
|
||||
play_progress_sec, last_played_at, play_count, last_quality, created_at, updated_at
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON CONFLICT(username, song_id) DO UPDATE SET
|
||||
source = excluded.source,
|
||||
songmid = excluded.songmid,
|
||||
|
||||
Reference in New Issue
Block a user