From 5e48491da58f06f6e28416bfdcd97d174b9c49c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=92=E7=A0=82=E7=B3=96?= <90336521+lings03@users.noreply.github.com> Date: Fri, 7 Mar 2025 19:28:49 +0800 Subject: [PATCH] [komiic] fix category (#52) (cherry picked from commit 4d9a8cc3470d293a06cffee6ac13b5d061732801) --- index.json | 2 +- komiic.js | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/index.json b/index.json index 9b9eec6..da9bb9d 100644 --- a/index.json +++ b/index.json @@ -9,7 +9,7 @@ "name": "Komiic", "fileName": "komiic.js", "key": "Komiic", - "version": "1.0.1" + "version": "1.0.2" }, { "name": "包子漫画", diff --git a/komiic.js b/komiic.js index 995cd40..106c4fb 100644 --- a/komiic.js +++ b/komiic.js @@ -6,7 +6,7 @@ class Komiic extends ComicSource { // 唯一标识符 key = "Komiic" - version = "1.0.1" + version = "1.0.2" minAppVersion = "1.0.0" @@ -175,7 +175,44 @@ class Komiic extends ComicSource { /// 分类漫画页面, 即点击分类标签后进入的页面 categoryComics = { load: async (category, param, options, page) => { - return await this.queryComics({ "operationName": "comicByCategory", "variables": { "categoryId": param, "pagination": { "limit": 30, "offset": (page - 1) * 30, "orderBy": options[0], "asc": false, "status": options[1] } }, "query": "query comicByCategory($categoryId: ID!, $pagination: Pagination!) {\n comicByCategory(categoryId: $categoryId, pagination: $pagination) {\n id\n title\n status\n year\n imageUrl\n authors {\n id\n name\n __typename\n }\n categories {\n id\n name\n __typename\n }\n dateUpdated\n monthViews\n views\n favoriteCount\n lastBookUpdate\n lastChapterUpdate\n __typename\n }\n}" }) + let variables = { + pagination: { + limit: 30, + offset: (page - 1) * 30, + orderBy: options[0], + asc: false, + status: options[1] + } + }; + + if (param !== '0') { + variables.categoryId = [param]; + } else { + variables.categoryId = []; + } + + return await this.queryComics({ + "operationName": "comicByCategories", + "variables": variables, + "query": `query comicByCategories($categoryId: [ID!]!, $pagination: Pagination!) { + comicByCategories(categoryId: $categoryId, pagination: $pagination) { + id + title + status + year + imageUrl + authors { id name __typename } + categories { id name __typename } + dateUpdated + monthViews + views + favoriteCount + lastBookUpdate + lastChapterUpdate + __typename + } + }` + }) }, // 提供选项 optionList: [