首页>代码>微信公众账号开发接口实现 - java servlet>/Wechat/src/com/nko/bean/Parameter.java
package com.nko.bean;

import java.util.List;

/**
 * 微信xml消息中的参数列表
 * @author ZZK
 *
 */
public class Parameter {
	private String fromUserName;
	private String toUserName;
	private String msgType;
	private String time;
	private String content;
	private String url;
	private String picUrl;
	private String title;
	private String description;
	private String funcFlag;
	private String event;
	private String eventKey;
	private List<Parameter> item;
	private String category;	// 标识信息是发送的还是接收的

	public List<Parameter> getItem() {
		return item;
	}
	public void setItem(List<Parameter> item) {
		this.item = item;
	}
	public String getFromUserName() {
		return fromUserName;
	}
	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}
	public String getToUserName() {
		return toUserName;
	}
	public void setToUserName(String toUserName) {
		this.toUserName = toUserName;
	}
	public String getMsgType() {
		return msgType;
	}
	public void setMsgType(String type) {
		this.msgType = type;
	}
	public String getTime() {
		return time;
	}
	public void setTime(String time) {
		this.time = time;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getUrl() {
		if(this.msgType.equals("link"))
			return this.content.substring(
				this.content.indexOf("href=\"") + ("href=\"").length(),
				this.content.indexOf("\">"));
		else
			return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getPicUrl() {
		return picUrl;
	}
	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getFuncFlag() {
		return funcFlag;
	}
	public void setFuncFlag(String funcFlag) {
		this.funcFlag = funcFlag;
	}
	public String getEvent() {
		return event;
	}
	public void setEvent(String event) {
		this.event = event;
	}
	public String getEventKey() {
		return eventKey;
	}
	public void setEventKey(String eventKey) {
		this.eventKey = eventKey;
	}
	public String getCategory() {
		return category;
	}
	public void setCategory(String category) {
		this.category = category;
	}

	public static void main(String[] args) {
//		List<Parameter> list = new ArrayList<Parameter>();
//		Parameter param = new Parameter();
//		param.setToUserName("toUser");
//		param.setFromUserName("gh_584fc179bafc");
//		param.setMsgType("text");
//		param.setContent("这是一条文本消息");
//		param.setCategory("发送");
//		list.add(param);
//		param.setToUserName("toUser");
//		param.setFromUserName("gh_584fc179bafc");
//		param.setMsgType("text");
//		param.setContent("这是又一条文本消息");
//		param.setCategory("发送");
//		list.add(param);
//
////		try {
////			json = JsonFactory.toJson(list);
////		} catch (Exception e) {
////			e.printStackTrace();
////		}
////		System.out.println(json);
//
//		JSONArray json = JSONArray.fromObject(param);
//		System.out.println(json);
	}
}
最近下载更多
liu2022  LV14 2022年7月31日
dongzhan  LV12 2021年12月16日
Tayirjan  LV11 2021年12月1日
tcloud  LV1 2021年10月30日
陈志远  LV1 2021年9月8日
seiseisizuka  LV1 2021年8月5日
yuzhang  LV2 2021年2月1日
wfqdxdx  LV6 2020年5月21日
MrZive  LV6 2020年5月6日
linghongjun5002  LV10 2020年4月15日
最近浏览更多
libo1212  LV8 6月17日
Luck_ZDM  LV11 5月31日
Gin19960217  LV4 1月12日
jerryPang  LV1 2023年6月28日
井晓码 2023年4月14日
暂无贡献等级
dengjunjun  LV15 2023年1月11日
uni-code_0123  LV1 2022年11月3日
babyFF9  LV8 2022年9月26日
微信网友_6139616720490496  LV1 2022年9月19日
xiex909  LV27 2022年8月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友