mirror of
https://gitee.com/hotlcc/wechat4j.git
synced 2025-06-08 03:24:09 +08:00
提交代码
This commit is contained in:
parent
334c803134
commit
088eb6d162
@ -1,10 +1,10 @@
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.hotlcc.wechat4j.Wechat;
|
import com.hotlcc.wechat4j.Wechat;
|
||||||
import com.hotlcc.wechat4j.api.WebWeixinApi;
|
import com.hotlcc.wechat4j.api.WebWeixinApi;
|
||||||
import com.hotlcc.wechat4j.handler.ReceivedMsgHandler;
|
import com.hotlcc.wechat4j.handler.ReceivedMsgHandler;
|
||||||
import com.hotlcc.wechat4j.model.ReceivedMsg;
|
import com.hotlcc.wechat4j.model.ReceivedMsg;
|
||||||
import com.hotlcc.wechat4j.model.UserInfo;
|
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 class TestClass2 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -15,17 +15,11 @@ public class TestClass2 {
|
|||||||
@Override
|
@Override
|
||||||
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
|
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
|
||||||
UserInfo contact = wechat.getContactByUserName(false, msg.getFromUserName());
|
UserInfo contact = wechat.getContactByUserName(false, msg.getFromUserName());
|
||||||
System.out.println(contact.getRemarkName() + ":" + msg.getContent());
|
String name = StringUtil.isEmpty(contact.getRemarkName()) ? contact.getNickName() : contact.getRemarkName();
|
||||||
if ("李国栋".equals(contact.getRemarkName())) {
|
System.out.println(name + ": " + msg.getContent());
|
||||||
JSONObject result = wechat.sendText("你的消息收到了", contact.getUserName());
|
|
||||||
System.out.println(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
wechat.autoLogin();
|
wechat.autoLogin();
|
||||||
UserInfo userInfo = wechat.getContactByNickName(false, "Allen");
|
CommonUtil.threadSleep(60000);
|
||||||
System.out.println(JSONObject.toJSONString(userInfo));
|
|
||||||
wechat.sendText("aaa", userInfo.getUserName());
|
|
||||||
wechat.logout();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user