diff --git a/publish/changeLog.md b/publish/changeLog.md index e47d606..257705f 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -35,6 +35,7 @@ - 修复mg歌单搜索歌单播放数量显示问题 - 修复搜索提示功能失效的问题(@Folltoshe) - 修复潜在导致列表数据不同步的问题 +- 修复kg无评论时的加载处理问题 ### 其他 diff --git a/src/utils/musicSdk/kg/comment.js b/src/utils/musicSdk/kg/comment.js index fbf59fc..9de91bb 100644 --- a/src/utils/musicSdk/kg/comment.js +++ b/src/utils/musicSdk/kg/comment.js @@ -19,7 +19,8 @@ export default { const { body, statusCode } = await _requestObj.promise // console.log(body) if (statusCode != 200 || body.err_code !== 0) throw new Error('获取评论失败') - return { source: 'kg', comments: this.filterComment(body.list || []), total: body.count, page, limit, maxPage: body.maxPage } + const total = body.count ?? 0 + return { source: 'kg', comments: this.filterComment(body.list || []), total, page, limit, maxPage: Math.ceil(total / limit) || 1 } }, async getHotComment({ hash }, page = 1, limit = 20) { // console.log(songmid) @@ -36,7 +37,7 @@ export default { // console.log(body) if (statusCode != 200 || body.err_code !== 0) throw new Error('获取热门评论失败') const total = body.count ?? 0 - return { source: 'kg', comments: this.filterComment(body.list || []), total, page, limit, maxPage: Math.ceil(body.count / limit) || 1 } + return { source: 'kg', comments: this.filterComment(body.list || []), total, page, limit, maxPage: Math.ceil(total / limit) || 1 } }, async getReplyComment({ songmid, audioId }, replyId, page = 1, limit = 100) { if (this._requestObj2) this._requestObj2.cancelHttp()