2
0
mirror of https://gitee.com/hotlcc/wechat4j.git synced 2025-06-07 19:14:08 +08:00

提交代码

This commit is contained in:
Allen 2018-08-17 21:28:20 +08:00
parent 334c803134
commit 088eb6d162

View File

@ -1,10 +1,10 @@
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.sun.scenario.effect.GaussianShadow;
import com.hotlcc.wechat4j.util.CommonUtil;
import com.hotlcc.wechat4j.util.StringUtil;
public class TestClass2 {
public static void main(String[] args) {
@ -15,17 +15,11 @@ public class TestClass2 {
@Override
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
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);
}
String name = StringUtil.isEmpty(contact.getRemarkName()) ? contact.getNickName() : contact.getRemarkName();
System.out.println(name + ": " + msg.getContent());
}
});
wechat.autoLogin();
UserInfo userInfo = wechat.getContactByNickName(false, "Allen");
System.out.println(JSONObject.toJSONString(userInfo));
wechat.sendText("aaa", userInfo.getUserName());
wechat.logout();
CommonUtil.threadSleep(60000);
}
}