2
0
mirror of https://gitee.com/hotlcc/wechat4j.git synced 2025-12-27 04:19:31 +08:00

提交代码

This commit is contained in:
hotlcc
2018-07-25 15:41:05 +08:00
parent 1e028d62ed
commit 5db685323f
9 changed files with 375 additions and 282 deletions

View File

@@ -1,9 +1,9 @@
import com.alibaba.fastjson.JSONObject;
import com.hotlcc.wechat4j.Wechat;
import com.hotlcc.wechat4j.api.WebWeixinApi;
import com.hotlcc.wechat4j.handler.ReceivedMsgHandler;
import com.hotlcc.wechat4j.model.ReceivedMsg;
import com.hotlcc.wechat4j.model.UserInfo;
import com.hotlcc.wechat4j.util.CommonUtil;
public class TestClass2 {
public static void main(String[] args) {
@@ -13,14 +13,14 @@ public class TestClass2 {
wechat.addReceivedMsgHandler(new ReceivedMsgHandler() {
@Override
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
System.out.println("===收到消息:" + msg.getContent());
UserInfo contact = wechat.getContactByUserName(false, msg.getFromUserName());
System.out.println(contact.getRemarkName() + "" + msg.getContent());
if ("李国栋".equals(contact.getRemarkName())) {
JSONObject result = wechat.sendText("你的消息收到了", contact.getUserName());
System.out.println(result);
}
}
});
wechat.autoLogin();
CommonUtil.threadSleep(1000 * 60 * 10);
wechat.logout();
}
}