diff --git a/publish/changeLog.md b/publish/changeLog.md index ff4bd59c..91dd24ad 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -29,6 +29,7 @@ - 修复windows平台下隐藏窗口后再显示时任务栏按钮丢失的问题 - 修复首句歌词被提前播放的问题 - 修复潜在导致列表数据不同步的问题 +- 修复kg无评论时的加载处理问题 ### 其他 diff --git a/src/renderer/utils/musicSdk/kg/comment.js b/src/renderer/utils/musicSdk/kg/comment.js index bbc8d453..e4493721 100644 --- a/src/renderer/utils/musicSdk/kg/comment.js +++ b/src/renderer/utils/musicSdk/kg/comment.js @@ -18,7 +18,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) @@ -34,7 +35,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()