Skip to content

Commit

Permalink
fix: 歌单播放限制1000首
Browse files Browse the repository at this point in the history
  • Loading branch information
GuMengYu committed Oct 16, 2022
1 parent 5944473 commit 86a3dac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/renderer/src/api/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const getTrackList = async (type: 'album' | 'playlist' | 'artist', id: nu
let res: { id: number; tracks: Track[]; name?: string }
if (type === 'playlist') {
const { playlist } = await getPlaylistDetail(id)
const { songs } = await getPlaylistTrackAll(id)
const { songs } = await getPlaylistTrackAll(playlist)
res = {
id: playlist.id,
name: playlist.name,
Expand Down
6 changes: 3 additions & 3 deletions packages/renderer/src/api/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ export const getPlaylistDetail = (id: number, realTime = false) => {
* @param offset 默认值为0
* @returns Playlist
*/
export const getPlaylistTrackAll = (id: number, limit?: number, offset = 0) => {
export const getPlaylistTrackAll = (playlist: Playlist, limit?: number, offset = 0) => {
const params: {
id: number
limit?: number
offset?: number
timestamp?: number
} = { id, offset }
limit && (params.limit = limit)
} = { id: playlist.id, offset }
params.limit = limit ?? playlist.trackIds.length >= 1000 ? 1000 : playlist.trackIds.length
return request<{
songs: Track[]
privileges: []
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/src/pages/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function fetch(id: number, flush = false) {
// ”我喜欢的音乐“ 歌单能够返回完整的tracks, 所以不用重新请求完整列表
await nextTick()
if (!isMyFavPlayList.value && state.playlist.trackIds?.length) {
const { songs } = await getPlaylistTrackAll(id)
const { songs } = await getPlaylistTrackAll(playlist)
state.playlist.tracks = songs
}
if (playlist.id) {
Expand Down

0 comments on commit 86a3dac

Please sign in to comment.