From a0ba42acbc4c7c7a643a4645236a3a2898ac06d1 Mon Sep 17 00:00:00 2001 From: Acexy Date: Sun, 30 Sep 2018 14:09:05 +0800 Subject: [PATCH] 1.0.10 dev --- README.md | 3 ++- pom.xml | 4 ++-- src/main/java/com/thankjava/wqq/SmartQQClientBuilder.java | 2 +- .../thankjava/wqq/core/request/api/BaseHttpService.java | 7 ++++++- .../wqq/core/request/api/CheckLoginQRcodeStatus.java | 2 +- src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java | 3 ++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e0be871..5fff334 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ 移除了历史版本登录测试方法和历史登录的相关支持代码 调整了测试代码优化了大量代码注释 1.1.2 - 升级部分依赖组件版本 + 升级部分依赖组件版本 + 关闭httpclient cookie检查的警告日志 ``` --- diff --git a/pom.xml b/pom.xml index 4ece92d..fb50e48 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,8 @@ UTF-8 UTF-8 - 1.0.9 - 4.1.3 + 1.0.10-SNAPSHOT + 4.1.4 1.2.49 1.7.25 1.2.3 diff --git a/src/main/java/com/thankjava/wqq/SmartQQClientBuilder.java b/src/main/java/com/thankjava/wqq/SmartQQClientBuilder.java index d1e4f9e..cada295 100644 --- a/src/main/java/com/thankjava/wqq/SmartQQClientBuilder.java +++ b/src/main/java/com/thankjava/wqq/SmartQQClientBuilder.java @@ -19,7 +19,7 @@ public class SmartQQClientBuilder { private SmartQQClientBuilder() { } - + private static SmartQQClient smartQQClient; /** diff --git a/src/main/java/com/thankjava/wqq/core/request/api/BaseHttpService.java b/src/main/java/com/thankjava/wqq/core/request/api/BaseHttpService.java index 3b685bc..9975632 100644 --- a/src/main/java/com/thankjava/wqq/core/request/api/BaseHttpService.java +++ b/src/main/java/com/thankjava/wqq/core/request/api/BaseHttpService.java @@ -5,6 +5,7 @@ import com.thankjava.toolkit3d.http.async.AsyncHttpClient; import com.thankjava.toolkit3d.http.async.AsyncHttpClientBuilder; import com.thankjava.toolkit3d.http.async.entity.AsyncRequest; +import com.thankjava.toolkit3d.http.async.entity.CookieCheckLevel; import com.thankjava.wqq.consts.ConstsParams; import com.thankjava.wqq.core.request.RequestBuilder; import com.thankjava.wqq.entity.Session; @@ -15,7 +16,11 @@ public abstract class BaseHttpService implements RequestBuilder { protected static final AtomicLong msgId = new AtomicLong(ConstsParams.INIT_MSG_ID); - public final static AsyncHttpClient asyncHttpClient = AsyncHttpClientBuilder.createDefault(); + public final static AsyncHttpClient asyncHttpClient = new AsyncHttpClientBuilder() + .setWithoutSSLCheck() + .setCookiePolicyLevel(CookieCheckLevel.BROWSER_COMPATIBILITY) + .setCloseWarnLogger() + .create(); /** * 关闭AsyncHttpClient diff --git a/src/main/java/com/thankjava/wqq/core/request/api/CheckLoginQRcodeStatus.java b/src/main/java/com/thankjava/wqq/core/request/api/CheckLoginQRcodeStatus.java index 22bb189..6a7c43d 100644 --- a/src/main/java/com/thankjava/wqq/core/request/api/CheckLoginQRcodeStatus.java +++ b/src/main/java/com/thankjava/wqq/core/request/api/CheckLoginQRcodeStatus.java @@ -23,7 +23,7 @@ public AsyncResponse doRequest(CallBackListener listener) { protected AsyncRequest buildRequestParams() { Parameters params = new Parameters("webqq_type", "10"); - params.append("ptqrtoken", WqqEncryptor.hashForCheckQrStatus(asyncHttpClient.getCookie("qrsig").getValue())); + params.append("ptqrtoken", WqqEncryptor.hashForCheckQrStatus(asyncHttpClient.getCookieFromClientContext("qrsig").getValue())); params.append("webqq_type", "10"); params.append("remember_uin", "1"); params.append("login2qq", "1"); diff --git a/src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java b/src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java index 5e42b22..be681bb 100644 --- a/src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java +++ b/src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java @@ -81,8 +81,10 @@ public void onListener(ActionListener actionListener) { // ListenerAction.data 返回登录结果 com.thankjava.wqq.entity.sys.LoginResult @Override public void onListener(ActionListener actionListener) { + LoginResult loginResult = (LoginResult) actionListener.getData(); logger.info("登录结果: " + loginResult.getLoginStatus()); + if (loginResult.getLoginStatus() == LoginResultStatus.success) { SmartQQClient smartQQClient = loginResult.getClient(); @@ -91,7 +93,6 @@ public void onListener(ActionListener actionListener) { logger.info("获取到的好友列表信息: " + FastJson.toJSONString(smartQQClient.getFriendsList(true))); - // 业务处理 // TODO: