fix: QQ 音乐未登录时搜索给出明确提示(接口对匿名请求返回空结果)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,10 @@ export class QQProvider implements MusicProvider {
|
|||||||
param: { query: keyword, num_per_page: limit, page_num: page, search_type: 0 },
|
param: { query: keyword, num_per_page: limit, page_num: page, search_type: 0 },
|
||||||
});
|
});
|
||||||
const list: any[] = data?.body?.song?.list || [];
|
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 };
|
return { items: list.map((t) => this.toSummary(t)), total: data?.meta?.sum ?? list.length, page, limit };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ const qqHint = computed(() => state.source === 'qq' && qqStatus.value && !qqStat
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<p v-if="qqHint" class="hint">
|
<p v-if="qqHint" class="hint">
|
||||||
QQ 音乐尚未登录,只能下载免费曲目。<RouterLink to="/settings">去导入 Cookie →</RouterLink>
|
QQ 音乐尚未登录,搜索与下载都需要登录。<RouterLink to="/settings">去扫码登录 →</RouterLink>
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user