新增基于lxserver的音乐功能

This commit is contained in:
mtvpls
2026-04-13 23:17:57 +08:00
parent 7469cc1537
commit c82d7b3841
30 changed files with 2740 additions and 546 deletions
+9 -10
View File
@@ -9,7 +9,7 @@ interface Song {
artist: string;
album?: string;
pic?: string;
platform: 'netease' | 'qq' | 'kuwo';
platform: 'wy' | 'tx' | 'kw' | 'kg' | 'mg';
duration?: number;
}
@@ -56,10 +56,10 @@ export default function AddToPlaylistModal({
const loadPlaylists = async () => {
try {
setLoading(true);
const response = await fetch('/api/music/playlists');
const response = await fetch('/api/music/v2/playlists');
if (response.ok) {
const data = await response.json();
setPlaylists(data.playlists || []);
setPlaylists(data.data?.playlists || []);
}
} catch (error) {
console.error('加载歌单失败:', error);
@@ -76,7 +76,7 @@ export default function AddToPlaylistModal({
try {
setCreating(true);
const response = await fetch('/api/music/playlists', {
const response = await fetch('/api/music/v2/playlists', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
@@ -107,19 +107,18 @@ export default function AddToPlaylistModal({
try {
setAddingToPlaylistId(playlistId);
const response = await fetch('/api/music/playlists/songs', {
const response = await fetch(`/api/music/v2/playlists/${playlistId}/songs`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
playlistId,
song: {
platform: song.platform,
id: song.id,
source: song.platform,
songId: song.id,
name: song.name,
artist: song.artist,
album: song.album,
pic: song.pic,
duration: song.duration || 0,
cover: song.pic,
durationSec: song.duration || 0,
},
}),
});