发送方消息处理
消息基类
public class BaseMessage {BaseMessage
//接收方账号(收到的openId)
private String ToUserName;
//开发者微信号
private String FromUserName;
//消息创建时间(整型)
private long CreateTime;
//消息类型(text/music/news)
private String MsgType;
//位0x0001 被标记时,星标刚收到的消息
private int FuncFlag;
public String getToUserName() {
return ToUserName;
}
public void setToUserName(String toUserName) {
ToUserName = toUserName;
}
public String getFromUserName() {
return FromUserName;
}
public void setFromUserName(String fromUserName) {
FromUserName = fromUserName;
}
public long getCreateTime() {
return CreateTime;
}
public void setCreateTime(long createTime) {
CreateTime = createTime;
}
public String getMsgType() {
return MsgType;
}
public void setMsgType(String msgType) {
MsgType = msgType;
}
public int getFuncFlag() {
return FuncFlag;
}
public void setFuncFlag(int funcFlag) {
FuncFlag = funcFlag;
}
}
链接消息
public class LinkMessage extends BaseMessage{LinkMessage
//消息标题
private String Title;
//消息描述
private String Description;
//消息链接
private String Url;
public String getTitle() {
return Title;
}
public void setTitle(String title) {
Title = title;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public String getUrl() {
return Url;
}
public void setUrl(String url) {
Url = url;
}
}
位置消息
public class LocationMessage extends BaseMessage {LocationMessage
//地理位置维度
private String Location_X;
//地理位置经度
private String Location_Y;
//地图缩放大小
private String Scale;
//地理位置信息
private String Label;
public String getLocation_X() {
return Location_X;
}
public void setLocation_X(String locationX) {
Location_X = locationX;
}
public String getLocation_Y() {
return Location_Y;
}
public void setLocation_Y(String locationY) {
Location_Y = locationY;
}
public String getScale() {
return Scale;
}
public void setScale(String scale) {
Scale = scale;
}
public String getLabel() {
return Label;
}
public void setLabel(String label) {
Label = label;
}
}
文本消息
public class TextMessage extends BaseMessage{TextMessage
//消息内容
private String content;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
语音消息
public class VoiceMessage extends BaseMessage{VoiceMessage
//媒体Id
private String MediaId;
//语音格式
private String Format;
public String getMediaId() {
return MediaId;
}
public void setMediaId(String mediaId) {
MediaId = mediaId;
}
public String getFormat() {
return Format;
}
public void setFormat(String format) {
Format = format;
}
}
图片消息
public class ImageMessage extends BaseMessage{ImageMessage
//图片链接
private String PicUrl;
public String getPicUrl() {
return PicUrl;
}
public void setPicUrl(String picUrl) {
PicUrl = picUrl;
}
}