mirror of
https://gitee.com/hotlcc/wechat4j.git
synced 2025-06-29 21:52:46 +08:00
提交代码
This commit is contained in:
parent
1e028d62ed
commit
5db685323f
@ -1049,20 +1049,20 @@ public class Wechat {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSONObject sendText(String Content, String ToUserName) {
|
public JSONObject sendText(String content, String toUserName) {
|
||||||
BaseRequest BaseRequest = new BaseRequest(wxsid, skey, wxuin);
|
BaseRequest BaseRequest = new BaseRequest(wxsid, skey, wxuin);
|
||||||
|
|
||||||
String msgId = WechatUtil.createMsgId();
|
String msgId = WechatUtil.createMsgId();
|
||||||
String loginUserName = getLoginUserName(false);
|
String loginUserName = getLoginUserName(false);
|
||||||
WxMessage message = new WxMessage();
|
WxMessage message = new WxMessage();
|
||||||
message.setClientMsgId(msgId);
|
message.setClientMsgId(msgId);
|
||||||
message.setContent(Content);
|
message.setContent(content);
|
||||||
message.setFromUserName(loginUserName);
|
message.setFromUserName(loginUserName);
|
||||||
message.setLocalID(msgId);
|
message.setLocalID(msgId);
|
||||||
if (StringUtil.isEmpty(ToUserName)) {
|
if (StringUtil.isEmpty(toUserName)) {
|
||||||
message.setToUserName(loginUserName);
|
message.setToUserName(loginUserName);
|
||||||
} else {
|
} else {
|
||||||
message.setToUserName(ToUserName);
|
message.setToUserName(toUserName);
|
||||||
}
|
}
|
||||||
message.setType(MsgTypeEnum.TEXT_MSG.getCode());
|
message.setType(MsgTypeEnum.TEXT_MSG.getCode());
|
||||||
|
|
||||||
@ -1074,50 +1074,50 @@ public class Wechat {
|
|||||||
/**
|
/**
|
||||||
* 发送文本消息(根据昵称)
|
* 发送文本消息(根据昵称)
|
||||||
*
|
*
|
||||||
* @param Content
|
* @param content
|
||||||
* @param NickName
|
* @param nickName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSONObject sendTextToNickName(String Content, String NickName) {
|
public JSONObject sendTextToNickName(String content, String nickName) {
|
||||||
if (StringUtil.isEmpty(NickName)) {
|
if (StringUtil.isEmpty(nickName)) {
|
||||||
return sendText(Content, null);
|
return sendText(content, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInfo userInfo = getContactByNickName(false, NickName);
|
UserInfo userInfo = getContactByNickName(false, nickName);
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String UserName = userInfo.getUserName();
|
String userName = userInfo.getUserName();
|
||||||
if (StringUtil.isEmpty(UserName)) {
|
if (StringUtil.isEmpty(userName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendText(Content, UserName);
|
return sendText(content, userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送文本消息(根据备注名)
|
* 发送文本消息(根据备注名)
|
||||||
*
|
*
|
||||||
* @param Content
|
* @param content
|
||||||
* @param RemarkName
|
* @param remarkName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSONObject sendTextToRemarkName(String Content, String RemarkName) {
|
public JSONObject sendTextToRemarkName(String content, String remarkName) {
|
||||||
if (StringUtil.isEmpty(RemarkName)) {
|
if (StringUtil.isEmpty(remarkName)) {
|
||||||
return sendText(Content, null);
|
return sendText(content, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInfo userInfo = getContactByRemarkName(false, RemarkName);
|
UserInfo userInfo = getContactByRemarkName(false, remarkName);
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String UserName = userInfo.getUserName();
|
String userName = userInfo.getUserName();
|
||||||
if (StringUtil.isEmpty(UserName)) {
|
if (StringUtil.isEmpty(userName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendText(Content, UserName);
|
return sendText(content, userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,6 +542,7 @@ public class WebWeixinApi {
|
|||||||
paramJson.put("BaseRequest", BaseRequest);
|
paramJson.put("BaseRequest", BaseRequest);
|
||||||
paramJson.put("Msg", message);
|
paramJson.put("Msg", message);
|
||||||
paramJson.put("Scene", 0);
|
paramJson.put("Scene", 0);
|
||||||
|
System.out.println(paramJson.toJSONString());
|
||||||
HttpEntity paramEntity = new StringEntity(paramJson.toJSONString(), Consts.UTF_8);
|
HttpEntity paramEntity = new StringEntity(paramJson.toJSONString(), Consts.UTF_8);
|
||||||
httpPost.setEntity(paramEntity);
|
httpPost.setEntity(paramEntity);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.hotlcc.wechat4j.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -10,15 +11,17 @@ public final class AppInfo {
|
|||||||
private AppInfo() {
|
private AppInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer Type;
|
@JSONField(name = "Type")
|
||||||
private String AppID;
|
private Integer type;
|
||||||
|
@JSONField(name = "AppID")
|
||||||
|
private String appID;
|
||||||
|
|
||||||
public Integer getType() {
|
public Integer getType() {
|
||||||
return Type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAppID() {
|
public String getAppID() {
|
||||||
return AppID;
|
return appID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AppInfo valueOf(JSONObject info) {
|
public static AppInfo valueOf(JSONObject info) {
|
||||||
@ -26,8 +29,8 @@ public final class AppInfo {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AppInfo appInfo = new AppInfo();
|
AppInfo appInfo = new AppInfo();
|
||||||
appInfo.Type = info.getInteger("Type");
|
appInfo.type = info.getInteger("Type");
|
||||||
appInfo.AppID = info.getString("AppID");
|
appInfo.appID = info.getString("AppID");
|
||||||
return appInfo;
|
return appInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.hotlcc.wechat4j.model;
|
package com.hotlcc.wechat4j.model;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.hotlcc.wechat4j.util.WechatUtil;
|
import com.hotlcc.wechat4j.util.WechatUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,51 +10,55 @@ public class BaseRequest {
|
|||||||
public BaseRequest() {
|
public BaseRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseRequest(String DeviceID, String Sid, String Skey, String Uin) {
|
public BaseRequest(String deviceID, String sid, String skey, String uin) {
|
||||||
this.DeviceID = DeviceID;
|
this.deviceID = deviceID;
|
||||||
this.Sid = Sid;
|
this.sid = sid;
|
||||||
this.Skey = Skey;
|
this.skey = skey;
|
||||||
this.Uin = Uin;
|
this.uin = uin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseRequest(String Sid, String Skey, String Uin) {
|
public BaseRequest(String Sid, String Skey, String Uin) {
|
||||||
this(WechatUtil.createDeviceID(), Sid, Skey, Uin);
|
this(WechatUtil.createDeviceID(), Sid, Skey, Uin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String DeviceID;
|
@JSONField(name = "DeviceID")
|
||||||
private String Sid;
|
private String deviceID;
|
||||||
private String Skey;
|
@JSONField(name = "Sid")
|
||||||
private String Uin;
|
private String sid;
|
||||||
|
@JSONField(name = "Skey")
|
||||||
|
private String skey;
|
||||||
|
@JSONField(name = "Uin")
|
||||||
|
private String uin;
|
||||||
|
|
||||||
public String getDeviceID() {
|
public String getDeviceID() {
|
||||||
return DeviceID;
|
return deviceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeviceID(String deviceID) {
|
public void setDeviceID(String deviceID) {
|
||||||
DeviceID = deviceID;
|
deviceID = deviceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSid() {
|
public String getSid() {
|
||||||
return Sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSid(String sid) {
|
public void setSid(String sid) {
|
||||||
Sid = sid;
|
sid = sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSkey() {
|
public String getSkey() {
|
||||||
return Skey;
|
return skey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSkey(String skey) {
|
public void setSkey(String skey) {
|
||||||
Skey = skey;
|
skey = skey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUin() {
|
public String getUin() {
|
||||||
return Uin;
|
return uin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUin(String uin) {
|
public void setUin(String uin) {
|
||||||
Uin = uin;
|
uin = uin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.hotlcc.wechat4j.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -10,145 +11,173 @@ public final class ReceivedMsg {
|
|||||||
private ReceivedMsg() {
|
private ReceivedMsg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer SubMsgType;
|
@JSONField(name = "SubMsgType")
|
||||||
private Long VoiceLength;
|
private Integer subMsgType;
|
||||||
private String FileName;
|
@JSONField(name = "VoiceLength")
|
||||||
private Long ImgHeight;
|
private Long voiceLength;
|
||||||
private String ToUserName;
|
@JSONField(name = "FileName")
|
||||||
private Long HasProductId;
|
private String fileName;
|
||||||
private Integer ImgStatus;
|
@JSONField(name = "ImgHeight")
|
||||||
private String Url;
|
private Long imgHeight;
|
||||||
private Integer ImgWidth;
|
@JSONField(name = "ToUserName")
|
||||||
private Integer ForwardFlag;
|
private String toUserName;
|
||||||
private Integer Status;
|
@JSONField(name = "HasProductId")
|
||||||
private String Ticket;
|
private Long hasProductId;
|
||||||
private RecommendInfo RecommendInfo;
|
@JSONField(name = "ImgStatus")
|
||||||
private Long CreateTime;
|
private Integer imgStatus;
|
||||||
private Long NewMsgId;
|
@JSONField(name = "Url")
|
||||||
private Integer MsgType;
|
private String url;
|
||||||
private String EncryFileName;
|
@JSONField(name = "ImgWidth")
|
||||||
private String MsgId;
|
private Integer imgWidth;
|
||||||
private Integer StatusNotifyCode;
|
@JSONField(name = "ForwardFlag")
|
||||||
private AppInfo AppInfo;
|
private Integer forwardFlag;
|
||||||
private Integer AppMsgType;
|
@JSONField(name = "Status")
|
||||||
private Long PlayLength;
|
private Integer status;
|
||||||
private String MediaId;
|
@JSONField(name = "Ticket")
|
||||||
private String Content;
|
private String ticket;
|
||||||
private String StatusNotifyUserName;
|
@JSONField(name = "RecommendInfo")
|
||||||
private String FromUserName;
|
private RecommendInfo recommendInfo;
|
||||||
private String OriContent;
|
@JSONField(name = "CreateTime")
|
||||||
private String FileSize;
|
private Long createTime;
|
||||||
|
@JSONField(name = "NewMsgId")
|
||||||
|
private Long newMsgId;
|
||||||
|
@JSONField(name = "MsgType")
|
||||||
|
private Integer msgType;
|
||||||
|
@JSONField(name = "EncryFileName")
|
||||||
|
private String encryFileName;
|
||||||
|
@JSONField(name = "MsgId")
|
||||||
|
private String msgId;
|
||||||
|
@JSONField(name = "StatusNotifyCode")
|
||||||
|
private Integer statusNotifyCode;
|
||||||
|
@JSONField(name = "AppInfo")
|
||||||
|
private AppInfo appInfo;
|
||||||
|
@JSONField(name = "AppMsgType")
|
||||||
|
private Integer appMsgType;
|
||||||
|
@JSONField(name = "PlayLength")
|
||||||
|
private Long playLength;
|
||||||
|
@JSONField(name = "MediaId")
|
||||||
|
private String mediaId;
|
||||||
|
@JSONField(name = "Content")
|
||||||
|
private String content;
|
||||||
|
@JSONField(name = "StatusNotifyUserName")
|
||||||
|
private String statusNotifyUserName;
|
||||||
|
@JSONField(name = "FromUserName")
|
||||||
|
private String fromUserName;
|
||||||
|
@JSONField(name = "OriContent")
|
||||||
|
private String oriContent;
|
||||||
|
@JSONField(name = "FileSize")
|
||||||
|
private String fileSize;
|
||||||
|
|
||||||
public Integer getSubMsgType() {
|
public Integer getSubMsgType() {
|
||||||
return SubMsgType;
|
return subMsgType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getVoiceLength() {
|
public Long getVoiceLength() {
|
||||||
return VoiceLength;
|
return voiceLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return FileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getImgHeight() {
|
public Long getImgHeight() {
|
||||||
return ImgHeight;
|
return imgHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToUserName() {
|
public String getToUserName() {
|
||||||
return ToUserName;
|
return toUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getHasProductId() {
|
public Long getHasProductId() {
|
||||||
return HasProductId;
|
return hasProductId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getImgStatus() {
|
public Integer getImgStatus() {
|
||||||
return ImgStatus;
|
return imgStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return Url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getImgWidth() {
|
public Integer getImgWidth() {
|
||||||
return ImgWidth;
|
return imgWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getForwardFlag() {
|
public Integer getForwardFlag() {
|
||||||
return ForwardFlag;
|
return forwardFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStatus() {
|
public Integer getStatus() {
|
||||||
return Status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTicket() {
|
public String getTicket() {
|
||||||
return Ticket;
|
return ticket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public com.hotlcc.wechat4j.model.RecommendInfo getRecommendInfo() {
|
public com.hotlcc.wechat4j.model.RecommendInfo getRecommendInfo() {
|
||||||
return RecommendInfo;
|
return recommendInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getCreateTime() {
|
public Long getCreateTime() {
|
||||||
return CreateTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getNewMsgId() {
|
public Long getNewMsgId() {
|
||||||
return NewMsgId;
|
return newMsgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMsgType() {
|
public Integer getMsgType() {
|
||||||
return MsgType;
|
return msgType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEncryFileName() {
|
public String getEncryFileName() {
|
||||||
return EncryFileName;
|
return encryFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMsgId() {
|
public String getMsgId() {
|
||||||
return MsgId;
|
return msgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStatusNotifyCode() {
|
public Integer getStatusNotifyCode() {
|
||||||
return StatusNotifyCode;
|
return statusNotifyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppInfo getAppInfo() {
|
public AppInfo getAppInfo() {
|
||||||
return AppInfo;
|
return appInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAppMsgType() {
|
public Integer getAppMsgType() {
|
||||||
return AppMsgType;
|
return appMsgType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPlayLength() {
|
public Long getPlayLength() {
|
||||||
return PlayLength;
|
return playLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMediaId() {
|
public String getMediaId() {
|
||||||
return MediaId;
|
return mediaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
return Content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatusNotifyUserName() {
|
public String getStatusNotifyUserName() {
|
||||||
return StatusNotifyUserName;
|
return statusNotifyUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFromUserName() {
|
public String getFromUserName() {
|
||||||
return FromUserName;
|
return fromUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOriContent() {
|
public String getOriContent() {
|
||||||
return OriContent;
|
return oriContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileSize() {
|
public String getFileSize() {
|
||||||
return FileSize;
|
return fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ReceivedMsg valueOf(JSONObject msg) {
|
public static ReceivedMsg valueOf(JSONObject msg) {
|
||||||
@ -158,33 +187,33 @@ public final class ReceivedMsg {
|
|||||||
|
|
||||||
ReceivedMsg receivedMsg = new ReceivedMsg();
|
ReceivedMsg receivedMsg = new ReceivedMsg();
|
||||||
|
|
||||||
receivedMsg.SubMsgType = msg.getInteger("SubMsgType");
|
receivedMsg.subMsgType = msg.getInteger("SubMsgType");
|
||||||
receivedMsg.VoiceLength = msg.getLong("VoiceLength");
|
receivedMsg.voiceLength = msg.getLong("VoiceLength");
|
||||||
receivedMsg.FileName = msg.getString("FileName");
|
receivedMsg.fileName = msg.getString("FileName");
|
||||||
receivedMsg.ImgHeight = msg.getLong("ImgHeight");
|
receivedMsg.imgHeight = msg.getLong("ImgHeight");
|
||||||
receivedMsg.ToUserName = msg.getString("ToUserName");
|
receivedMsg.toUserName = msg.getString("ToUserName");
|
||||||
receivedMsg.HasProductId = msg.getLong("HasProductId");
|
receivedMsg.hasProductId = msg.getLong("HasProductId");
|
||||||
receivedMsg.ImgStatus = msg.getInteger("ImgStatus");
|
receivedMsg.imgStatus = msg.getInteger("ImgStatus");
|
||||||
receivedMsg.Url = msg.getString("Url");
|
receivedMsg.url = msg.getString("Url");
|
||||||
receivedMsg.ImgWidth = msg.getInteger("ImgWidth");
|
receivedMsg.imgWidth = msg.getInteger("ImgWidth");
|
||||||
receivedMsg.ForwardFlag = msg.getInteger("ForwardFlag");
|
receivedMsg.forwardFlag = msg.getInteger("ForwardFlag");
|
||||||
receivedMsg.Status = msg.getInteger("Status");
|
receivedMsg.status = msg.getInteger("Status");
|
||||||
receivedMsg.Ticket = msg.getString("Ticket");
|
receivedMsg.ticket = msg.getString("Ticket");
|
||||||
receivedMsg.RecommendInfo = com.hotlcc.wechat4j.model.RecommendInfo.valueOf(msg.getJSONObject("RecommendInfo"));
|
receivedMsg.recommendInfo = com.hotlcc.wechat4j.model.RecommendInfo.valueOf(msg.getJSONObject("RecommendInfo"));
|
||||||
receivedMsg.CreateTime = msg.getLong("CreateTime");
|
receivedMsg.createTime = msg.getLong("CreateTime");
|
||||||
receivedMsg.NewMsgId = msg.getLong("NewMsgId");
|
receivedMsg.newMsgId = msg.getLong("NewMsgId");
|
||||||
receivedMsg.MsgType = msg.getInteger("MsgType");
|
receivedMsg.msgType = msg.getInteger("MsgType");
|
||||||
receivedMsg.EncryFileName = msg.getString("EncryFileName");
|
receivedMsg.encryFileName = msg.getString("EncryFileName");
|
||||||
receivedMsg.MsgId = msg.getString("MsgId");
|
receivedMsg.msgId = msg.getString("MsgId");
|
||||||
receivedMsg.StatusNotifyCode = msg.getInteger("StatusNotifyCode");
|
receivedMsg.statusNotifyCode = msg.getInteger("StatusNotifyCode");
|
||||||
receivedMsg.AppInfo = com.hotlcc.wechat4j.model.AppInfo.valueOf(msg.getJSONObject("AppInfo"));
|
receivedMsg.appInfo = com.hotlcc.wechat4j.model.AppInfo.valueOf(msg.getJSONObject("AppInfo"));
|
||||||
receivedMsg.PlayLength = msg.getLong("PlayLength");
|
receivedMsg.playLength = msg.getLong("PlayLength");
|
||||||
receivedMsg.MediaId = msg.getString("MediaId");
|
receivedMsg.mediaId = msg.getString("MediaId");
|
||||||
receivedMsg.Content = msg.getString("Content");
|
receivedMsg.content = msg.getString("Content");
|
||||||
receivedMsg.StatusNotifyUserName = msg.getString("StatusNotifyUserName");
|
receivedMsg.statusNotifyUserName = msg.getString("StatusNotifyUserName");
|
||||||
receivedMsg.FromUserName = msg.getString("FromUserName");
|
receivedMsg.fromUserName = msg.getString("FromUserName");
|
||||||
receivedMsg.OriContent = msg.getString("OriContent");
|
receivedMsg.oriContent = msg.getString("OriContent");
|
||||||
receivedMsg.FileSize = msg.getString("FileSize");
|
receivedMsg.fileSize = msg.getString("FileSize");
|
||||||
|
|
||||||
return receivedMsg;
|
return receivedMsg;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.hotlcc.wechat4j.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -10,75 +11,89 @@ public final class RecommendInfo {
|
|||||||
private RecommendInfo() {
|
private RecommendInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String Ticket;
|
@JSONField(name = "Ticket")
|
||||||
private String UserName;
|
private String ticket;
|
||||||
private Integer Sex;
|
@JSONField(name = "UserName")
|
||||||
private Integer AttrStatus;
|
private String userName;
|
||||||
private String City;
|
@JSONField(name = "Sex")
|
||||||
private String NickName;
|
private Integer sex;
|
||||||
private Integer Scene;
|
@JSONField(name = "AttrStatus")
|
||||||
private String Province;
|
private Integer attrStatus;
|
||||||
private String Content;
|
@JSONField(name = "City")
|
||||||
private String Alias;
|
private String city;
|
||||||
private String Signature;
|
@JSONField(name = "NickName")
|
||||||
private Integer OpCode;
|
private String nickName;
|
||||||
private Long QQNum;
|
@JSONField(name = "Scene")
|
||||||
private Integer VerifyFlag;
|
private Integer scene;
|
||||||
|
@JSONField(name = "Province")
|
||||||
|
private String province;
|
||||||
|
@JSONField(name = "Content")
|
||||||
|
private String content;
|
||||||
|
@JSONField(name = "Alias")
|
||||||
|
private String alias;
|
||||||
|
@JSONField(name = "Signature")
|
||||||
|
private String signature;
|
||||||
|
@JSONField(name = "OpCode")
|
||||||
|
private Integer opCode;
|
||||||
|
@JSONField(name = "QQNum")
|
||||||
|
private Long qqNum;
|
||||||
|
@JSONField(name = "VerifyFlag")
|
||||||
|
private Integer verifyFlag;
|
||||||
|
|
||||||
public String getTicket() {
|
public String getTicket() {
|
||||||
return Ticket;
|
return ticket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
return UserName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSex() {
|
public Integer getSex() {
|
||||||
return Sex;
|
return sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAttrStatus() {
|
public Integer getAttrStatus() {
|
||||||
return AttrStatus;
|
return attrStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCity() {
|
public String getCity() {
|
||||||
return City;
|
return city;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNickName() {
|
public String getNickName() {
|
||||||
return NickName;
|
return nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getScene() {
|
public Integer getScene() {
|
||||||
return Scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProvince() {
|
public String getProvince() {
|
||||||
return Province;
|
return province;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
return Content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
return Alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSignature() {
|
public String getSignature() {
|
||||||
return Signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getOpCode() {
|
public Integer getOpCode() {
|
||||||
return OpCode;
|
return opCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getQQNum() {
|
public Long getQQNum() {
|
||||||
return QQNum;
|
return qqNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getVerifyFlag() {
|
public Integer getVerifyFlag() {
|
||||||
return VerifyFlag;
|
return verifyFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RecommendInfo valueOf(JSONObject info) {
|
public static RecommendInfo valueOf(JSONObject info) {
|
||||||
@ -88,20 +103,20 @@ public final class RecommendInfo {
|
|||||||
|
|
||||||
RecommendInfo recommendInfo = new RecommendInfo();
|
RecommendInfo recommendInfo = new RecommendInfo();
|
||||||
|
|
||||||
recommendInfo.Ticket = info.getString("Ticket");
|
recommendInfo.ticket = info.getString("Ticket");
|
||||||
recommendInfo.UserName = info.getString("UserName");
|
recommendInfo.userName = info.getString("UserName");
|
||||||
recommendInfo.Sex = info.getInteger("Sex");
|
recommendInfo.sex = info.getInteger("Sex");
|
||||||
recommendInfo.AttrStatus = info.getInteger("AttrStatus");
|
recommendInfo.attrStatus = info.getInteger("AttrStatus");
|
||||||
recommendInfo.City = info.getString("City");
|
recommendInfo.city = info.getString("City");
|
||||||
recommendInfo.NickName = info.getString("NickName");
|
recommendInfo.nickName = info.getString("NickName");
|
||||||
recommendInfo.Scene = info.getInteger("Scene");
|
recommendInfo.scene = info.getInteger("Scene");
|
||||||
recommendInfo.Province = info.getString("Province");
|
recommendInfo.province = info.getString("Province");
|
||||||
recommendInfo.Content = info.getString("Content");
|
recommendInfo.content = info.getString("Content");
|
||||||
recommendInfo.Alias = info.getString("Alias");
|
recommendInfo.alias = info.getString("Alias");
|
||||||
recommendInfo.Signature = info.getString("Signature");
|
recommendInfo.signature = info.getString("Signature");
|
||||||
recommendInfo.OpCode = info.getInteger("OpCode");
|
recommendInfo.opCode = info.getInteger("OpCode");
|
||||||
recommendInfo.QQNum = info.getLong("QQNum");
|
recommendInfo.qqNum = info.getLong("QQNum");
|
||||||
recommendInfo.VerifyFlag = info.getInteger("VerifyFlag");
|
recommendInfo.verifyFlag = info.getInteger("VerifyFlag");
|
||||||
|
|
||||||
return recommendInfo;
|
return recommendInfo;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.hotlcc.wechat4j.model;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -13,160 +14,191 @@ public final class UserInfo {
|
|||||||
private UserInfo() {
|
private UserInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long Uin;
|
@JSONField(name = "Uin")
|
||||||
private String NickName;
|
private Long uin;
|
||||||
private String HeadImgUrl;
|
@JSONField(name = "NickName")
|
||||||
private Integer ContactFlag;
|
private String nickName;
|
||||||
private Integer MemberCount;
|
@JSONField(name = "HeadImgUrl")
|
||||||
private List<UserInfo> MemberList;
|
private String headImgUrl;
|
||||||
private String RemarkName;
|
@JSONField(name = "ContactFlag")
|
||||||
private Integer HideInputBarFlag;
|
private Integer contactFlag;
|
||||||
private Integer Sex;
|
@JSONField(name = "MemberCount")
|
||||||
private String Signature;
|
private Integer memberCount;
|
||||||
private Integer VerifyFlag;
|
@JSONField(name = "MemberList")
|
||||||
private Long OwnerUin;
|
private List<UserInfo> memberList;
|
||||||
private String PYInitial;
|
@JSONField(name = "RemarkName")
|
||||||
private String PYQuanPin;
|
private String remarkName;
|
||||||
private String RemarkPYInitial;
|
@JSONField(name = "HideInputBarFlag")
|
||||||
private String RemarkPYQuanPin;
|
private Integer hideInputBarFlag;
|
||||||
private Integer StarFriend;
|
@JSONField(name = "Sex")
|
||||||
private Integer AppAccountFlag;
|
private Integer sex;
|
||||||
private Integer Statues;
|
@JSONField(name = "Signature")
|
||||||
private Integer AttrStatus;
|
private String signature;
|
||||||
private String Province;
|
@JSONField(name = "VerifyFlag")
|
||||||
private String City;
|
private Integer verifyFlag;
|
||||||
private String Alias;
|
@JSONField(name = "OwnerUin")
|
||||||
private Integer SnsFlag;
|
private Long ownerUin;
|
||||||
private Integer UniFriend;
|
@JSONField(name = "PYInitial")
|
||||||
private String DisplayName;
|
private String pyInitial;
|
||||||
private Long ChatRoomId;
|
@JSONField(name = "PYQuanPin")
|
||||||
private String KeyWord;
|
private String pyQuanPin;
|
||||||
private String EncryChatRoomId;
|
@JSONField(name = "RemarkPYInitial")
|
||||||
private Integer IsOwner;
|
private String remarkPYInitial;
|
||||||
private String UserName;
|
@JSONField(name = "RemarkPYQuanPin")
|
||||||
|
private String remarkPYQuanPin;
|
||||||
|
@JSONField(name = "StarFriend")
|
||||||
|
private Integer starFriend;
|
||||||
|
@JSONField(name = "AppAccountFlag")
|
||||||
|
private Integer appAccountFlag;
|
||||||
|
@JSONField(name = "Statues")
|
||||||
|
private Integer statues;
|
||||||
|
@JSONField(name = "AttrStatus")
|
||||||
|
private Integer attrStatus;
|
||||||
|
@JSONField(name = "Province")
|
||||||
|
private String province;
|
||||||
|
@JSONField(name = "City")
|
||||||
|
private String city;
|
||||||
|
@JSONField(name = "Alias")
|
||||||
|
private String alias;
|
||||||
|
@JSONField(name = "SnsFlag")
|
||||||
|
private Integer snsFlag;
|
||||||
|
@JSONField(name = "UniFriend")
|
||||||
|
private Integer uniFriend;
|
||||||
|
@JSONField(name = "DisplayName")
|
||||||
|
private String displayName;
|
||||||
|
@JSONField(name = "ChatRoomId")
|
||||||
|
private Long chatRoomId;
|
||||||
|
@JSONField(name = "KeyWord")
|
||||||
|
private String keyWord;
|
||||||
|
@JSONField(name = "EncryChatRoomId")
|
||||||
|
private String encryChatRoomId;
|
||||||
|
@JSONField(name = "IsOwner")
|
||||||
|
private Integer isOwner;
|
||||||
|
@JSONField(name = "UserName")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
public Long getUin() {
|
public Long getUin() {
|
||||||
return Uin;
|
return uin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNickName() {
|
public String getNickName() {
|
||||||
return NickName;
|
return nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHeadImgUrl() {
|
public String getHeadImgUrl() {
|
||||||
return HeadImgUrl;
|
return headImgUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getContactFlag() {
|
public Integer getContactFlag() {
|
||||||
return ContactFlag;
|
return contactFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMemberCount() {
|
public Integer getMemberCount() {
|
||||||
return MemberCount;
|
return memberCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UserInfo> getMemberList() {
|
public List<UserInfo> getMemberList() {
|
||||||
return MemberList;
|
return memberList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemarkName() {
|
public String getRemarkName() {
|
||||||
return RemarkName;
|
return remarkName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getHideInputBarFlag() {
|
public Integer getHideInputBarFlag() {
|
||||||
return HideInputBarFlag;
|
return hideInputBarFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSex() {
|
public Integer getSex() {
|
||||||
return Sex;
|
return sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSignature() {
|
public String getSignature() {
|
||||||
return Signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getVerifyFlag() {
|
public Integer getVerifyFlag() {
|
||||||
return VerifyFlag;
|
return verifyFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getOwnerUin() {
|
public Long getOwnerUin() {
|
||||||
return OwnerUin;
|
return ownerUin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPYInitial() {
|
public String getPYInitial() {
|
||||||
return PYInitial;
|
return pyInitial;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPYQuanPin() {
|
public String getPYQuanPin() {
|
||||||
return PYQuanPin;
|
return pyQuanPin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemarkPYInitial() {
|
public String getRemarkPYInitial() {
|
||||||
return RemarkPYInitial;
|
return remarkPYInitial;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemarkPYQuanPin() {
|
public String getRemarkPYQuanPin() {
|
||||||
return RemarkPYQuanPin;
|
return remarkPYQuanPin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStarFriend() {
|
public Integer getStarFriend() {
|
||||||
return StarFriend;
|
return starFriend;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAppAccountFlag() {
|
public Integer getAppAccountFlag() {
|
||||||
return AppAccountFlag;
|
return appAccountFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStatues() {
|
public Integer getStatues() {
|
||||||
return Statues;
|
return statues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAttrStatus() {
|
public Integer getAttrStatus() {
|
||||||
return AttrStatus;
|
return attrStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProvince() {
|
public String getProvince() {
|
||||||
return Province;
|
return province;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCity() {
|
public String getCity() {
|
||||||
return City;
|
return city;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
return Alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSnsFlag() {
|
public Integer getSnsFlag() {
|
||||||
return SnsFlag;
|
return snsFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUniFriend() {
|
public Integer getUniFriend() {
|
||||||
return UniFriend;
|
return uniFriend;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return DisplayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getChatRoomId() {
|
public Long getChatRoomId() {
|
||||||
return ChatRoomId;
|
return chatRoomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKeyWord() {
|
public String getKeyWord() {
|
||||||
return KeyWord;
|
return keyWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEncryChatRoomId() {
|
public String getEncryChatRoomId() {
|
||||||
return EncryChatRoomId;
|
return encryChatRoomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getIsOwner() {
|
public Integer getIsOwner() {
|
||||||
return IsOwner;
|
return isOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
return UserName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserInfo valueOf(JSONObject info) {
|
public static UserInfo valueOf(JSONObject info) {
|
||||||
@ -176,37 +208,37 @@ public final class UserInfo {
|
|||||||
|
|
||||||
UserInfo userInfo = new UserInfo();
|
UserInfo userInfo = new UserInfo();
|
||||||
|
|
||||||
userInfo.Uin = info.getLong("Uin");
|
userInfo.uin = info.getLong("Uin");
|
||||||
userInfo.NickName = info.getString("NickName");
|
userInfo.nickName = info.getString("NickName");
|
||||||
userInfo.HeadImgUrl = info.getString("HeadImgUrl");
|
userInfo.headImgUrl = info.getString("HeadImgUrl");
|
||||||
userInfo.ContactFlag = info.getInteger("ContactFlag");
|
userInfo.contactFlag = info.getInteger("ContactFlag");
|
||||||
userInfo.MemberCount = info.getInteger("MemberCount");
|
userInfo.memberCount = info.getInteger("MemberCount");
|
||||||
userInfo.MemberList = valueOf(info.getJSONArray("MemberList"));
|
userInfo.memberList = valueOf(info.getJSONArray("MemberList"));
|
||||||
userInfo.RemarkName = info.getString("RemarkName");
|
userInfo.remarkName = info.getString("RemarkName");
|
||||||
userInfo.HideInputBarFlag = info.getInteger("HideInputBarFlag");
|
userInfo.hideInputBarFlag = info.getInteger("HideInputBarFlag");
|
||||||
userInfo.Sex = info.getInteger("Sex");
|
userInfo.sex = info.getInteger("Sex");
|
||||||
userInfo.Signature = info.getString("Signature");
|
userInfo.signature = info.getString("Signature");
|
||||||
userInfo.VerifyFlag = info.getInteger("VerifyFlag");
|
userInfo.verifyFlag = info.getInteger("VerifyFlag");
|
||||||
userInfo.OwnerUin = info.getLong("OwnerUin");
|
userInfo.ownerUin = info.getLong("OwnerUin");
|
||||||
userInfo.PYInitial = info.getString("PYInitial");
|
userInfo.pyInitial = info.getString("PYInitial");
|
||||||
userInfo.PYQuanPin = info.getString("PYQuanPin");
|
userInfo.pyQuanPin = info.getString("PYQuanPin");
|
||||||
userInfo.RemarkPYInitial = info.getString("RemarkPYInitial");
|
userInfo.remarkPYInitial = info.getString("RemarkPYInitial");
|
||||||
userInfo.RemarkPYQuanPin = info.getString("RemarkPYQuanPin");
|
userInfo.remarkPYQuanPin = info.getString("RemarkPYQuanPin");
|
||||||
userInfo.StarFriend = info.getInteger("StarFriend");
|
userInfo.starFriend = info.getInteger("StarFriend");
|
||||||
userInfo.AppAccountFlag = info.getInteger("AppAccountFlag");
|
userInfo.appAccountFlag = info.getInteger("AppAccountFlag");
|
||||||
userInfo.Statues = info.getInteger("Statues");
|
userInfo.statues = info.getInteger("Statues");
|
||||||
userInfo.AttrStatus = info.getInteger("AttrStatus");
|
userInfo.attrStatus = info.getInteger("AttrStatus");
|
||||||
userInfo.Province = info.getString("Province");
|
userInfo.province = info.getString("Province");
|
||||||
userInfo.City = info.getString("City");
|
userInfo.city = info.getString("City");
|
||||||
userInfo.Alias = info.getString("Alias");
|
userInfo.alias = info.getString("Alias");
|
||||||
userInfo.SnsFlag = info.getInteger("SnsFlag");
|
userInfo.snsFlag = info.getInteger("SnsFlag");
|
||||||
userInfo.UniFriend = info.getInteger("UniFriend");
|
userInfo.uniFriend = info.getInteger("UniFriend");
|
||||||
userInfo.DisplayName = info.getString("DisplayName");
|
userInfo.displayName = info.getString("DisplayName");
|
||||||
userInfo.ChatRoomId = info.getLong("ChatRoomId");
|
userInfo.chatRoomId = info.getLong("ChatRoomId");
|
||||||
userInfo.KeyWord = info.getString("KeyWord");
|
userInfo.keyWord = info.getString("KeyWord");
|
||||||
userInfo.EncryChatRoomId = info.getString("EncryChatRoomId");
|
userInfo.encryChatRoomId = info.getString("EncryChatRoomId");
|
||||||
userInfo.IsOwner = info.getInteger("IsOwner");
|
userInfo.isOwner = info.getInteger("IsOwner");
|
||||||
userInfo.UserName = info.getString("UserName");
|
userInfo.userName = info.getString("UserName");
|
||||||
|
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,62 @@
|
|||||||
package com.hotlcc.wechat4j.model;
|
package com.hotlcc.wechat4j.model;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 要发送的消息
|
* 要发送的消息
|
||||||
*/
|
*/
|
||||||
public class WxMessage {
|
public class WxMessage {
|
||||||
private String ClientMsgId;
|
@JSONField(name = "ClientMsgId")
|
||||||
private String Content;
|
private String clientMsgId;
|
||||||
private String FromUserName;
|
@JSONField(name = "Content")
|
||||||
private String LocalID;
|
private String content;
|
||||||
private String ToUserName;
|
@JSONField(name = "FromUserName")
|
||||||
|
private String fromUserName;
|
||||||
|
@JSONField(name = "LocalID")
|
||||||
|
private String localID;
|
||||||
|
@JSONField(name = "ToUserName")
|
||||||
|
private String toUserName;
|
||||||
|
@JSONField(name = "Type")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
public String getClientMsgId() {
|
public String getClientMsgId() {
|
||||||
return ClientMsgId;
|
return clientMsgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClientMsgId(String clientMsgId) {
|
public void setClientMsgId(String clientMsgId) {
|
||||||
ClientMsgId = clientMsgId;
|
clientMsgId = clientMsgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
return Content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContent(String content) {
|
public void setContent(String content) {
|
||||||
Content = content;
|
content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFromUserName() {
|
public String getFromUserName() {
|
||||||
return FromUserName;
|
return fromUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFromUserName(String fromUserName) {
|
public void setFromUserName(String fromUserName) {
|
||||||
FromUserName = fromUserName;
|
fromUserName = fromUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalID() {
|
public String getLocalID() {
|
||||||
return LocalID;
|
return localID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocalID(String localID) {
|
public void setLocalID(String localID) {
|
||||||
LocalID = localID;
|
localID = localID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToUserName() {
|
public String getToUserName() {
|
||||||
return ToUserName;
|
return toUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToUserName(String toUserName) {
|
public void setToUserName(String toUserName) {
|
||||||
ToUserName = toUserName;
|
toUserName = toUserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getType() {
|
public Integer getType() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
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.hotlcc.wechat4j.util.CommonUtil;
|
|
||||||
|
|
||||||
public class TestClass2 {
|
public class TestClass2 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -13,14 +13,14 @@ public class TestClass2 {
|
|||||||
wechat.addReceivedMsgHandler(new ReceivedMsgHandler() {
|
wechat.addReceivedMsgHandler(new ReceivedMsgHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
|
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
|
||||||
System.out.println("===收到消息:" + msg.getContent());
|
|
||||||
UserInfo contact = wechat.getContactByUserName(false, msg.getFromUserName());
|
UserInfo contact = wechat.getContactByUserName(false, msg.getFromUserName());
|
||||||
|
System.out.println(contact.getRemarkName() + ":" + msg.getContent());
|
||||||
if ("李国栋".equals(contact.getRemarkName())) {
|
if ("李国栋".equals(contact.getRemarkName())) {
|
||||||
|
JSONObject result = wechat.sendText("你的消息收到了", contact.getUserName());
|
||||||
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
wechat.autoLogin();
|
wechat.autoLogin();
|
||||||
CommonUtil.threadSleep(1000 * 60 * 10);
|
|
||||||
wechat.logout();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user