diff --git a/publish/changeLog.md b/publish/changeLog.md index 43a7a052..93357964 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -9,3 +9,4 @@ - 修复音量条在调整音量时实际音量与显示的数值不一致的问题(#2606) - 修复某些情况下搜索框的搜索按钮布局错位的问题(#2622) +- 修复 wyy 部分歌曲无法被搜索的问题(#2666, @ikun0014) diff --git a/src/renderer/utils/musicSdk/wy/musicSearch.js b/src/renderer/utils/musicSdk/wy/musicSearch.js index 32024996..be32384b 100644 --- a/src/renderer/utils/musicSdk/wy/musicSearch.js +++ b/src/renderer/utils/musicSdk/wy/musicSearch.js @@ -10,12 +10,21 @@ export default { page: 0, allPage: 1, musicSearch(str, page, limit) { - const searchRequest = eapiRequest('/api/cloudsearch/pc', { - s: str, - type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频 - limit, - total: page == 1, + // const searchRequest = eapiRequest('/api/cloudsearch/pc', { + // s: str, + // type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频 + // limit, + // total: page == 1, + // offset: limit * (page - 1), + // }) + const searchRequest = eapiRequest('/api/search/song/list/page', { + keyword: str, + needCorrect: '1', + channel: 'typing', offset: limit * (page - 1), + scene: 'normal', + total: page == 1, + limit, }) return searchRequest.promise.then(({ body }) => body) }, @@ -30,6 +39,7 @@ export default { // console.log(rawList) if (!rawList) return [] return rawList.map(item => { + item = item.baseInfo.simpleSongData const types = [] const _types = {} let size @@ -87,12 +97,12 @@ export default { return this.musicSearch(str, page, limit).then(result => { // console.log(result) if (!result || result.code !== 200) return this.search(str, page, limit, retryNum) - let list = this.handleResult(result.result.songs || []) + let list = this.handleResult(result.data.resources || []) // console.log(list) if (list == null) return this.search(str, page, limit, retryNum) - this.total = result.result.songCount || 0 + this.total = result.data.totalCount || 0 this.page = page this.allPage = Math.ceil(this.total / this.limit)