From 368c78e17123033b5b6fe38a21f9887b1483d4e7 Mon Sep 17 00:00:00 2001 From: LamGC Date: Thu, 18 Jun 2020 10:05:34 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=20CacheStoreCentral,=20BotCommandProcess?= =?UTF-8?q?=20Search=E5=91=BD=E4=BB=A4=E5=A2=9E=E5=8A=A0=E5=AF=B9pageIndex?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BD=BF=E7=94=A8(=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=AB=9F=E7=84=B6=E6=98=AF=E4=B8=AA=E6=91=86=E8=AE=BE!=3F);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java | 2 +- .../java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java index 6d11c12..25b4b13 100644 --- a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java +++ b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java @@ -316,7 +316,7 @@ public class BotCommandProcess { ) throws IOException, InterruptedException { log.debug("正在执行搜索..."); JsonObject resultBody = CacheStoreCentral.getCentral() - .getSearchBody(content, type, area, includeKeywords, excludeKeywords, contentOption); + .getSearchBody(content, type, area, includeKeywords, excludeKeywords, contentOption, pagesIndex); StringBuilder result = new StringBuilder("内容 " + content + " 的搜索结果:\n"); log.debug("正在处理信息..."); diff --git a/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java b/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java index 5c4aa4d..a6bbe93 100644 --- a/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java +++ b/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreCentral.java @@ -423,7 +423,9 @@ public final class CacheStoreCentral { String area, String includeKeywords, String excludeKeywords, - String contentOption) throws IOException { + String contentOption, + int pageIndex + ) throws IOException { PixivSearchLinkBuilder searchBuilder = new PixivSearchLinkBuilder(Strings.isNullOrEmpty(content) ? "" : content); if (type != null) { try { @@ -463,6 +465,10 @@ public final class CacheStoreCentral { } } + if(pageIndex > 0) { + searchBuilder.setPage(pageIndex); + } + log.debug("正在搜索作品, 条件: {}", searchBuilder.getSearchCondition()); Locker locker