fix: QQ 音乐未登录时搜索给出明确提示(接口对匿名请求返回空结果)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jocay
2026-10-10 22:55:13 +08:00
parent 85b2d36b3d
commit 7a3de9afba
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -101,6 +101,10 @@ export class QQProvider implements MusicProvider {
param: { query: keyword, num_per_page: limit, page_num: page, search_type: 0 },
});
const list: any[] = data?.body?.song?.list || [];
// QQ 音乐搜索接口对未登录请求一律返回空结果
if (!list.length && !this.client.auth) {
throw Object.assign(new Error('QQ 音乐搜索需要先登录(设置 → 扫码登录)'), { status: 400 });
}
return { items: list.map((t) => this.toSummary(t)), total: data?.meta?.sum ?? list.length, page, limit };
}
+1 -1
View File
@@ -110,7 +110,7 @@ const qqHint = computed(() => state.source === 'qq' && qqStatus.value && !qqStat
</div>
</form>
<p v-if="qqHint" class="hint">
QQ 音乐尚未登录,只能下载免费曲目。<RouterLink to="/settings">去导入 Cookie →</RouterLink>
QQ 音乐尚未登录,搜索与下载都需要登录。<RouterLink to="/settings">去扫码登录 →</RouterLink>
</p>
</header>