mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-03-01 01:38:39 +08:00
59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
import request from '@/web/utils/request'
|
|
import {
|
|
FetchAudioSourceParams,
|
|
FetchAudioSourceResponse,
|
|
FetchLyricParams,
|
|
FetchLyricResponse,
|
|
FetchTracksParams,
|
|
FetchTracksResponse,
|
|
LikeATrackParams,
|
|
LikeATrackResponse,
|
|
} from '@/shared/api/Track'
|
|
|
|
// 获取歌曲详情
|
|
export function fetchTracks(params: FetchTracksParams): Promise<FetchTracksResponse> {
|
|
return request({
|
|
url: '/song/detail',
|
|
method: 'get',
|
|
params: {
|
|
ids: params.ids.join(','),
|
|
},
|
|
})
|
|
}
|
|
|
|
// 获取音源URL
|
|
export function fetchAudioSource(
|
|
params: FetchAudioSourceParams
|
|
): Promise<FetchAudioSourceResponse> {
|
|
return request({
|
|
url: '/song/url/v1',
|
|
method: 'get',
|
|
params: {
|
|
level: 'exhigh',
|
|
...params,
|
|
timestamp: Date.now(),
|
|
},
|
|
})
|
|
}
|
|
|
|
// 获取歌词
|
|
export function fetchLyric(params: FetchLyricParams): Promise<FetchLyricResponse> {
|
|
return request({
|
|
url: '/lyric',
|
|
method: 'get',
|
|
params,
|
|
})
|
|
}
|
|
|
|
// 收藏歌曲
|
|
export function likeATrack(params: LikeATrackParams): Promise<LikeATrackResponse> {
|
|
return request({
|
|
url: '/like',
|
|
method: 'post',
|
|
params: {
|
|
...params,
|
|
timestamp: Date.now(),
|
|
},
|
|
})
|
|
}
|