mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-18 06:07:48 +00:00
增加收藏歌曲和收藏歌单功能,优化播放器逻辑,修复bug以及体验优化
This commit is contained in:
parent
5f0ef06786
commit
7f75758b73
28 changed files with 486 additions and 270 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import request from "@/utils/request";
|
||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||
|
||||
export function getAlbum(id) {
|
||||
return request({
|
||||
|
|
@ -7,6 +8,9 @@ export function getAlbum(id) {
|
|||
params: {
|
||||
id,
|
||||
},
|
||||
}).then((data) => {
|
||||
data.songs = mapTrackPlayableStatus(data.songs);
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export function getArtist(id) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function getArtistAlbum(params) {
|
||||
// 必选参数 : id: 歌手 id
|
||||
// 可选参数 : limit: 取出数量 , 默认为 50
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import request from "@/utils/request";
|
||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||
|
||||
export function search(params) {
|
||||
return request({
|
||||
url: "/search",
|
||||
method: "get",
|
||||
params,
|
||||
}).then((data) => {
|
||||
if (data.result.song !== undefined)
|
||||
data.result.song.songs = mapTrackPlayableStatus(data.result.song.songs);
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ export function dailyRecommendPlaylist(params) {
|
|||
});
|
||||
}
|
||||
|
||||
export function getPlaylistDetail(id) {
|
||||
export function getPlaylistDetail(id, noCache = false) {
|
||||
let params = { id };
|
||||
if (noCache) params.timestamp = new Date().getTime();
|
||||
return request({
|
||||
url: "/playlist/detail",
|
||||
method: "get",
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -63,3 +63,13 @@ export function toplists() {
|
|||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
export function subscribePlaylist(params) {
|
||||
// 必选参数 :
|
||||
// t : 类型,1:收藏,2:取消收藏 id : 歌单 id
|
||||
return request({
|
||||
url: "/playlist/subscribe",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import request from "@/utils/request";
|
||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||
|
||||
export function getMP3(id) {
|
||||
return request({
|
||||
|
|
@ -17,6 +18,9 @@ export function getTrackDetail(id) {
|
|||
params: {
|
||||
ids: id,
|
||||
},
|
||||
}).then((data) => {
|
||||
data.songs = mapTrackPlayableStatus(data.songs);
|
||||
return data;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -45,3 +49,25 @@ export function topSong(type) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function likeATrack(params) {
|
||||
// 必选参数: id: 歌曲 id
|
||||
// 可选参数 : like: 布尔值 , 默认为 true 即喜欢 , 若传 false, 则取消喜欢
|
||||
params.timestamp = new Date().getTime();
|
||||
return request({
|
||||
url: "/like",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export function scrobble(params) {
|
||||
// 必选参数 : id: 歌曲 id, sourceid: 歌单或专辑 id
|
||||
// 可选参数 : time: 歌曲播放时间,单位为秒
|
||||
params.timestamp = new Date().getTime();
|
||||
return request({
|
||||
url: "/scrobble",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ export function userLikedSongsIDs(uid) {
|
|||
return request({
|
||||
url: "/likelist",
|
||||
method: "get",
|
||||
uid,
|
||||
params: {
|
||||
uid,
|
||||
timestamp: new Date().getTime(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue