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

Commit

Permalink
修改markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
acexy committed May 3, 2018
1 parent fdde2a6 commit a212322
Showing 1 changed file with 11 additions and 78 deletions.
89 changes: 11 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,80 +52,7 @@
```
---
> ### 使用
- 1.1.0之前(后续会彻底废弃)
```
参考com.thankjava.wqq.test.qq.TestSmartQQ & com.thankjava.wqq.test.qq.MessageListener
```
```java
package com.thankjava.wqq.test.qq;

import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

import com.thankjava.wqq.extend.ActionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

@Deprecated
public class TestSmartQQ {

private static final Logger logger = LoggerFactory.getLogger(TestSmartQQ.class);

// 初始化SmartQQClient
// 需要指明一个NotifyListener 该接口的实例会在 SmartQQClient 拉取到信息时被执行调用
static final SmartQQClient SMART_QQ_CLIENT = new WQQClient(new MessageHandler());


public static void main(String[] args) {

logger.debug("SmartQQ登录开始");

// 执行登录
SMART_QQ_CLIENT.login(true, new CallBackListener() {
// login 接口在得到登录二维码时会调用CallBackListener
// 并且二维码byte[] 数据会通过ListenerAction.data返回
@Override
public void onListener(ActionListener actionListener) {

try {
// 将返回的byte[]数据io处理成一张png图片
// 位于项目log/qrcode.png
ImageIO.write((BufferedImage) actionListener.getData(), "png", new File("./log/qrcode.png"));
logger.debug("获取登录二维码完成,手机QQ扫描 ./log/qrcode.png 位置的二维码图片");
} catch (Exception e) {
logger.error("将byte[]写为图片失败", e);
}

}
}, new CallBackListener() {

// 然后通过手机QQ扫描登录二维码,允许登录后smartqq-agreement-core工具就正常接收信息了
// 可以通过SmartQQClient.sendMsg向讨论组或者好友或者群组发送信息
// smartqq-agreement-core工具在得到好友|讨论组|群组信息后就会调用上面提到的NotifyListener.handler
// 自此你自需要拓展自己的回复消息的内容,就可以自定义自己的QQ机器人或者组件服务拉
// 登录完毕后会返回LoginResult 已反馈当前登录结果
@Override
public void onListener(ActionListener actionListener) {
// 登陆成功
logger.debug("登录结果: " + actionListener.getData());
}
});


}
}

```
- 1.1.0之后新版
```
参考com.thankjava.wqq.test.qq.TestSmartQQNewVersion & com.thankjava.wqq.test.qq.MessageListener
```
Expand All @@ -151,9 +78,9 @@ import java.io.File;
*
* @author acexy
*/
public class TestSmartQQNewVersion {
public class TestSmartQQ {

private static final Logger logger = LoggerFactory.getLogger(TestSmartQQNewVersion.class);
private static final Logger logger = LoggerFactory.getLogger(TestSmartQQ.class);

public static void main(String[] args) {

Expand All @@ -163,7 +90,7 @@ public class TestSmartQQNewVersion {
SmartQQClientBuilder builder = SmartQQClientBuilder.custom(

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


Expand Down Expand Up @@ -222,22 +149,28 @@ public class TestSmartQQNewVersion {
// TODO: 后续就可以利用smartQQClient调用API
logger.info("获取到的好友列表信息: " + FastJson.toJSONString(smartQQClient.getFriendsList(true)));



// 业务处理
// TODO:

}
}
};

// C: 进行登录动作
// C: 进行登录,启动服务
builder.createAndLogin(getQrListener, loginListener);
}

}



```
---
> ### Future
1. 持续优化可能存在的BUG
2. 响应可能用户提出的优化或建议方案
2. 响应用户提出的优化或建议方案
3. 跟进TX协议修改后的改动
4. 提高可用性

0 comments on commit a212322

Please sign in to comment.