From 87527688c32e7b38c37b8149e22a3b540d81afba Mon Sep 17 00:00:00 2001 From: QAIU <736226400@qq.com> Date: Tue, 17 Dec 2024 15:21:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BB=A3=E7=90=86=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/qaiu/parser/PanBase.java | 5 +---- .../src/main/java/cn/qaiu/lz/AppMain.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/parser/src/main/java/cn/qaiu/parser/PanBase.java b/parser/src/main/java/cn/qaiu/parser/PanBase.java index 6bee7ce..dcfd337 100644 --- a/parser/src/main/java/cn/qaiu/parser/PanBase.java +++ b/parser/src/main/java/cn/qaiu/parser/PanBase.java @@ -6,11 +6,9 @@ import io.vertx.core.Handler; import io.vertx.core.Promise; import io.vertx.core.json.DecodeException; -import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import io.vertx.core.net.ProxyOptions; import io.vertx.core.net.ProxyType; -import io.vertx.core.net.impl.VertxHandler; import io.vertx.ext.web.client.HttpResponse; import io.vertx.ext.web.client.WebClient; import io.vertx.ext.web.client.WebClientOptions; @@ -21,7 +19,6 @@ import java.util.Arrays; import java.util.Iterator; -import java.util.Map; /** * 解析器抽象类包含promise, HTTP Client, 默认失败方法等; @@ -77,7 +74,7 @@ public PanBase(ShareLinkInfo shareLinkInfo) { proxyOptions.setUsername(proxy.getString("username")); } if (StringUtils.isNotEmpty(proxy.getString("password"))) { - proxyOptions.setUsername(proxy.getString("password")); + proxyOptions.setPassword(proxy.getString("password")); } this.client = WebClient.create(WebClientVertxInit.get(), new WebClientOptions() diff --git a/web-service/src/main/java/cn/qaiu/lz/AppMain.java b/web-service/src/main/java/cn/qaiu/lz/AppMain.java index 4850e87..f7f0d8d 100644 --- a/web-service/src/main/java/cn/qaiu/lz/AppMain.java +++ b/web-service/src/main/java/cn/qaiu/lz/AppMain.java @@ -48,18 +48,19 @@ private static void exec(JsonObject jsonObject) { if (jsonObject.containsKey(ConfigConstant.PROXY)) { LocalMap localMap = VertxHolder.getVertxInstance().sharedData().getLocalMap(LOCAL); JsonArray proxyJsonArray = jsonObject.getJsonArray(ConfigConstant.PROXY); + if (proxyJsonArray != null) { + proxyJsonArray.forEach(proxyJson -> { + String panTypes = ((JsonObject)proxyJson).getString("panTypes"); - proxyJsonArray.forEach(proxyJson -> { - String panTypes = ((JsonObject)proxyJson).getString("panTypes"); - - if (!panTypes.isEmpty()) { - JsonObject jsonObject1 = new JsonObject(); - for (String s : panTypes.split(",")) { - jsonObject1.put(s, proxyJson); + if (!panTypes.isEmpty()) { + JsonObject jsonObject1 = new JsonObject(); + for (String s : panTypes.split(",")) { + jsonObject1.put(s, proxyJson); + } + localMap.put("proxy", jsonObject1); } - localMap.put("proxy", jsonObject1); - } - }); + }); + } } }