Skip to content

Commit e7e66de

Browse files
committed
v1.1 修复歌曲ID/歌单ID无法播放的BUG—因playid/gedanid被弃用
1 parent 020c0b2 commit e7e66de

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

index.html

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ <h2>网易云音乐</h2>
16171617
<label>音乐ID</label>
16181618
<input type="text" id="musicId" placeholder="输入网易云音乐ID">
16191619
</div>
1620-
<button class="btn control" onclick="playById()">
1620+
<button class="btn control" onclick="playById(document.getElementById('musicId').value)">
16211621
<span class="material-symbols-outlined">play_circle</span>
16221622
直接播放
16231623
</button>
@@ -2295,11 +2295,12 @@ <h2>歌单控制</h2>
22952295
if (song) sendCommand(`bot/use/0/(!yun add ${encodeURIComponent(song)})`);
22962296
}
22972297

2298-
function playById() {
2299-
const id = document.getElementById('musicId').value;
2300-
console.log('Play by ID:', id);
2298+
function playById(id) {
2299+
console.log('Play song:', id);
23012300
updateStatus('直接播放中...');
2302-
if (id) sendCommand(`bot/use/0/(!yun playid ${encodeURIComponent(id)})`);
2301+
if (id) {
2302+
sendCommand(`bot/use/0/(!yun play ${encodeURIComponent(id)})`);
2303+
}
23032304
}
23042305

23052306
function searchAndPlayList() {
@@ -2313,7 +2314,7 @@ <h2>歌单控制</h2>
23132314
const id = document.getElementById('playlistId').value;
23142315
console.log('Play playlist by ID:', id);
23152316
updateStatus('直接播放歌单中...');
2316-
if (id) sendCommand(`bot/use/0/(!yun gedanid ${encodeURIComponent(id)})`);
2317+
if (id) sendCommand(`bot/use/0/(!yun gedan ${encodeURIComponent(id)})`);
23172318
}
23182319

23192320
function playNextInPlaylist() {
@@ -2738,22 +2739,6 @@ <h2>歌单控制</h2>
27382739
}
27392740
}
27402741

2741-
// 修改playById函数,使其可以被历史记录调用
2742-
function playById(id) {
2743-
console.log('Play song:', id);
2744-
updateStatus('直接播放中...');
2745-
if (id) {
2746-
// 如果是从历史记录播放,使用 play 命令
2747-
if (typeof id === 'string') {
2748-
sendCommand(`bot/use/0/(/yun/play ${encodeURIComponent(id)}`);
2749-
} else {
2750-
// 如果是从输入框播放,使用 playid 命令
2751-
const inputId = document.getElementById('musicId').value;
2752-
if (inputId) sendCommand(`bot/use/0/(!yun playid ${encodeURIComponent(inputId)})`);
2753-
}
2754-
}
2755-
}
2756-
27572742
// 添加切换历史播放的函数
27582743
function toggleHistory() {
27592744
const historyContainer = document.getElementById('playlistHistory');

0 commit comments

Comments
 (0)