Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Commit

Permalink
1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
acexy committed May 3, 2018
1 parent ec6f6a1 commit 12a5800
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 50 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
废弃主动登录接口,合并到初始化自动完成
闭环登录环节的相关异常,各个需要业务控制的回调均提供反馈调用
增加稳定性,新增应用健康状态监控,提供优化掉线自动重连机制
1.1.1
移除了历史版本登录测试方法和历史登录的相关支持代码
```
---
Expand All @@ -53,7 +55,7 @@
- 1.1.0之前(后续会彻底废弃)

```
参考com.thankjava.wqq.test.qq.TestSmartQQ & com.thankjava.wqq.test.qq.MessageHandler
参考com.thankjava.wqq.test.qq.TestSmartQQ & com.thankjava.wqq.test.qq.MessageListener
```
```java
package com.thankjava.wqq.test.qq;
Expand Down Expand Up @@ -125,7 +127,7 @@ public class TestSmartQQ {
```
- 1.1.0之后新版
```
参考com.thankjava.wqq.test.qq.TestSmartQQNewVersion & com.thankjava.wqq.test.qq.MessageHandler
参考com.thankjava.wqq.test.qq.TestSmartQQNewVersion & com.thankjava.wqq.test.qq.MessageListener
```
```java
package com.thankjava.wqq.test.qq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ public AopParam doRequest(AopParam aopParam) {

if (listener != null) {
// 如果传递了listener 则通过listener的方式回调返回
ActionListener actionListener = new ActionListener();
try {
actionListener.setData(asyncHttpClient.syncRequestWithSession(asyncRequest));
listener.onListener(new ActionListener((asyncHttpClient.syncRequestWithSession(asyncRequest))));
} catch (Throwable e) {
logger.error("http request error", e);
actionListener.setData(null);
listener.onListener(new ActionListener());
}
listener.onListener(actionListener);


} else {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public SendBuddyMsg2(SendMsg sendMsg) {
@Override
public AsyncResponse doRequest(CallBackListener listener) {
if(listener != null){
ActionListener actionListener = new ActionListener();
actionListener.setData(asyncHttpClient.syncRequestWithSession(buildRequestParams()));
listener.onListener(actionListener);
listener.onListener(new ActionListener(asyncHttpClient.syncRequestWithSession(buildRequestParams())));
return null;
}else{
return asyncHttpClient.syncRequestWithSession(buildRequestParams());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public SendDiscuMsg2(SendMsg sendMsg) {
@Override
public AsyncResponse doRequest(CallBackListener listener) {
if(listener != null){
ActionListener actionListener = new ActionListener();
actionListener.setData(asyncHttpClient.syncRequestWithSession(buildRequestParams()));
listener.onListener(actionListener);
listener.onListener(new ActionListener(asyncHttpClient.syncRequestWithSession(buildRequestParams())));
return null;
}else{
return asyncHttpClient.syncRequestWithSession(buildRequestParams());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public SendQunMsg2(SendMsg sendMsg) {
@Override
public AsyncResponse doRequest(CallBackListener listener) {
if(listener != null){
ActionListener actionListener = new ActionListener();
actionListener.setData(asyncHttpClient.syncRequestWithSession(buildRequestParams()));
ActionListener actionListener = new ActionListener(asyncHttpClient.syncRequestWithSession(buildRequestParams()));
listener.onListener(actionListener);
return null;
}else{
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/thankjava/wqq/extend/ActionListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public Object getData() {
return data;
}

public void setData(Object data) {
this.data = data;
}
// public void setData(Object data) {
// this.data = data;
// }

}
6 changes: 6 additions & 0 deletions src/main/java/com/thankjava/wqq/extend/NotifyListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
*/
public interface NotifyListener {


/**
* 消息通知处理定义
* @param smartQQClient
* @param pollMsg
*/
public void handler(SmartQQClient smartQQClient, PollMsg pollMsg);
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
package com.thankjava.wqq.test.qq;

import com.thankjava.wqq.SmartQQClient;
import com.thankjava.wqq.entity.msg.PollMsg;
import com.thankjava.wqq.entity.msg.SendMsg;
import com.thankjava.wqq.extend.NotifyListener;

public class MessageHandler implements NotifyListener {

@Override
public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
switch (pollMsg.getMsgType()) {
case message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Friend`"));
break;
case group_message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Group`"));
break;
case discu_message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Discu`"));
break;
}
}

// sendMsg 接口能通过pollMsg得到msg的类型,然后自动回复该类型的msg
// @Override
// public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
// smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg"));
// }

}
package com.thankjava.wqq.test.qq;

import com.thankjava.wqq.SmartQQClient;
import com.thankjava.wqq.entity.msg.PollMsg;
import com.thankjava.wqq.entity.msg.SendMsg;
import com.thankjava.wqq.extend.NotifyListener;

public class MessageListener implements NotifyListener {

@Override
public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
switch (pollMsg.getMsgType()) {
case message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Friend`"));
break;
case group_message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Group`"));
break;
case discu_message:
smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg: `Discu`"));
break;
}
}

// sendMsg 接口能通过pollMsg得到msg的类型,然后自动回复该类型的msg
// @Override
// public void handler(SmartQQClient smartQQClient, PollMsg pollMsg) {
// smartQQClient.sendMsg(new SendMsg(pollMsg, "I Have Got Your Msg"));
// }

}
2 changes: 1 addition & 1 deletion src/test/java/com/thankjava/wqq/test/qq/TestSmartQQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args) {
SmartQQClientBuilder builder = SmartQQClientBuilder.custom(

// 注册一个通知事件的处理器,它将在SmartQQClient获得到相关信息时被调用执行
new MessageHandler()
new MessageListener()
);


Expand Down

0 comments on commit 12a5800

Please sign in to comment.