diff --git a/README.md b/README.md
index ac8a79d..dc315e2 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,11 @@
- [更多介绍](https://www.thankjava.com/opensource/069239e5eee95a2299b804d9f98f1f9a)
---
-> ### Bug fixes & 升级备注
+> ### 升级备注
```
+1.1.3
+ 升级了关键依赖版本
+ 掉线事件回调函数返回了SmartQQClient实例,方便业务关闭实例
1.1.2
升级部分依赖组件版本
关闭httpclient cookie检查的警告日志
diff --git a/pom.xml b/pom.xml
index 1f6eac9..bddb329 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.thankjava.wqq
smartqq-agreement-core
- 1.2.0
+ 1.1.3
org.sonatype.oss
@@ -19,7 +19,7 @@
UTF-8
UTF-8
- 1.1.0
+ 1.1.1-SNAPSHOT
4.1.4
1.2.49
1.7.25
diff --git a/src/main/java/com/thankjava/wqq/core/event/MsgPollEvent.java b/src/main/java/com/thankjava/wqq/core/event/MsgPollEvent.java
index 1633daa..7723e90 100644
--- a/src/main/java/com/thankjava/wqq/core/event/MsgPollEvent.java
+++ b/src/main/java/com/thankjava/wqq/core/event/MsgPollEvent.java
@@ -99,7 +99,7 @@ private boolean doExceptionCheck(PullMsgStatus pullMsgStatus) {
logger.debug("执行重连失败已达到上限,已放弃尝试");
CallBackListener callBackListener = WQQClient.getOfflineListener();
if (callBackListener != null) {
- callBackListener.onListener(new ActionListener());
+ callBackListener.onListener(new ActionListener(WQQClient.getInstance()));
}
}
} catch (Exception e) {
diff --git a/src/test/java/com/thankjava/wqq/test/qq/MessageListener.java b/src/test/java/com/thankjava/wqq/test/qq/MessageListener.java
index f071517..19538e9 100644
--- a/src/test/java/com/thankjava/wqq/test/qq/MessageListener.java
+++ b/src/test/java/com/thankjava/wqq/test/qq/MessageListener.java
@@ -4,15 +4,18 @@
import com.thankjava.wqq.entity.msg.PollMsg;
import com.thankjava.wqq.entity.msg.SendMsg;
import com.thankjava.wqq.extend.NotifyListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class MessageListener implements NotifyListener {
+ private static final Logger logger = LoggerFactory.getLogger(MessageListener.class);
@Override
public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
// 获取到的消息内容
- System.out.println("received msg : " + pollMsg.getMsgContext());
+ logger.debug("received msg : " + pollMsg.getMsgContext());
switch (pollMsg.getMsgType()) {
case message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Friend`"));
@@ -29,7 +32,7 @@ public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
// sendMsg 接口能通过pollMsg得到msg的类型,然后自动回复该类型的msg
// @Override
// public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
-// System.out.println("received msg : " + pollMsg.getMsgContext());
+// logger.debug("received msg : " + pollMsg.getMsgContext());
// smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg"));
// }
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 be681bb..c762e52 100644
--- a/src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java
+++ b/src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java
@@ -1,6 +1,6 @@
package com.thankjava.wqq.test.qq;
-import com.thankjava.toolkit3d.fastjson.FastJson;
+import com.thankjava.toolkit3d.core.fastjson.FastJson;
import com.thankjava.wqq.SmartQQClient;
import com.thankjava.wqq.SmartQQClientBuilder;
import com.thankjava.wqq.entity.enums.LoginResultStatus;
@@ -29,7 +29,6 @@ public static void main(String[] args) {
* step 1 > 利用指定使用SmartQQClientBuilder指南来构建SmartQQClient实例
*/
SmartQQClientBuilder builder = SmartQQClientBuilder.custom(
-
// 注册一个通知事件的处理器,它将在SmartQQClient获得到相关信息时被调用执行
new MessageListener()
);
@@ -42,12 +41,14 @@ public static void main(String[] args) {
.setAutoGetInfoAfterLogin() // 设置登录成功后立即拉取一些信息
.setExceptionRetryMaxTimes(3) // 设置如果请求异常重试3次
.setAutoRefreshQrcode() // 设置若发现登录二维码过期则自动重新拉取
-// .setOffLineListener(new CallBackListener() { // 注册一个离线通知 掉线后将被调用执行
-// @Override
-// public void onListener(ActionListener actionListener) {
-// logger.info("登录的QQ已由掉线无法继续使用(系统已经尝试自动处理)");
-// }
-// })
+ .setOffLineListener(new CallBackListener() { // 注册一个离线通知 掉线后将被调用执行
+ @Override
+ public void onListener(ActionListener actionListener) {
+ logger.info("登录的QQ已掉线无法继续使用(系统已经尝试自动处理)");
+ SmartQQClient smartQQClient = (SmartQQClient) actionListener.getData();
+ smartQQClient.shutdown();
+ }
+ })
;
/**