国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ?? ??? ?? ?? WeChat ?? ??? ?? ??? ??? ??? ???

WeChat ?? ??? ?? ??? ??? ??? ???

May 10, 2017 am 09:29 AM
java ??

? ??? ?? Java WeChat? 2? ??? ? ?? ??? ??? ?????. Java WeChat? ??? ??? ??? ????? ?? ?? ??? ? ??? ??? ? ????.

??? ????? Java WeChat? ??? ??? ??? ??????.

1??: com.wtz.message.response ???? ?? ?????. ? ??? Image.java

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午8:38:37
 * version:1.0
 * description:圖片的實體類
 */
public class Image {
 //圖片媒體ID
 private String MediaId;
 
 public String getMediaId() {
 return MediaId;
 }
 public void setMediaId(String mediaId) {
 MediaId = mediaId;
 }
}

2??:com.wtz.message.response ???? ?? ? ??? ImageMessage.java ???

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午8:49:57
 * version:1.0
 * description:圖片消息類
 */
public class ImageMessage extends BaseMessage {
 //圖片對象
 private Image image;

 public Image getImage() {
 return image;
 }

 public void setImage(Image image) {
 this.image = image;
 }
}

?? 3 :com.wtz.message.response ???? ?? ? ??? Video.java? ????

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午9:02:14
 * version:1.0
 * description:視頻的實體類
 */
public class Video {
 //視頻消息的媒體ID
 private String MediaId;
 //視頻消息的標(biāo)題
 private String Title;
 //視頻消息的描述
 private String Description;
 
 public String getMediaId() {
 return MediaId;
 }
 public void setMediaId(String mediaId) {
 MediaId = mediaId;
 }
 public String getTitle() {
 return Title;
 }
 public void setTitle(String title) {
 Title = title;
 }
 public String getDescription() {
 return Description;
 }
 public void setDescription(String description) {
 Description = description;
 }
}

4??: com.wtz.message.response ???? ?? ? ??? VideoMessage.java ???

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午9:10:14
 * version:1.0
 * description:視頻消息類
 */
public class VideoMessage extends BaseMessage{
 //視頻對象
 private Video video;

 public Video getVideo() {
 return video;
 }

 public void setVideo(Video video) {
 this.video = video;
 }
}

5??:com.wtz.message.response ???? ?? ? ??? Voice.java ???

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午9:21:47
 * version:1.0
 * description:語音消息實體類
 */
public class Voice {
 //語音媒體編號
 private String MediaId;
 
 public String getMediaId() {
 return MediaId;
 }
 public void setMediaId(String mediaId) {
 MediaId = mediaId;
 }
}

6??: com.wtz.message.response ???? ?? ? ??? VoiceMessage.java ???

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午9:44:58
 * version:1.0</p>
 * description:語音消息類
 */
public class VoiceMessage extends BaseMessage{
 //語音對象
 private Voice voice;

 public Voice getVoice() {
 return voice;
 }

 public void setVoice(Voice voice) {
 this.voice = voice;
 }
}

7??: com.wtz.message.response ?? Music.java ??? ? ? ??? ???

package com.wtz.message.response;
/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午9:48:11
 * version:1.0
 * description:音樂消息實體類
 */
public class Music {
 //音樂標(biāo)題
 private String Title;
 //音樂描述
 private String Description;
 //音樂鏈接
 private String MusicUrl;
 //高品質(zhì)音樂鏈接
 private String HQMusicUrl;
 //縮略圖的媒體ID
 private String ThumbMediaId;
 
 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 getMusicUrl() {
 return MusicUrl;
 }
 public void setMusicUrl(String musicUrl) {
 MusicUrl = musicUrl;
 }
 public String getHQMusicUrl() {
 return HQMusicUrl;
 }
 public void setHQMusicUrl(String hQMusicUrl) {
 HQMusicUrl = hQMusicUrl;
 }
 public String getThumbMediaId() {
 return ThumbMediaId;
 }
 public void setThumbMediaId(String thumbMediaId) {
 ThumbMediaId = thumbMediaId;
 }
}

8??: com.wtz.message.response ???? ?? ? ??? MusicMessage.java

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午9:58:21
 * <p>version:1.0</p>
 * <p>description:音樂消息類</p>
 */
public class MusicMessage extends BaseMessage{
 //音樂對象
 private Music music;

 public Music getMusic() {
 return music;
 }

 public void setMusic(Music music) {
 this.music = music;
 }
}

??? 9??: com.wtz .message.response ???? ?? ? ??? Article.java? ????

package com.wtz.message.response;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午10:05:29
 * <p>version:1.0</p>
 * <p>description:圖文實體類</p>
 */
public class Article {
 //圖文標(biāo)題
 private String Title;
 //圖文描述
 private String Description;
 //圖片鏈接,支持JPG,PNG格式,較好的效果為大圖
 private String PicUrl;
 //圖文消息跳轉(zhuǎn)鏈接
 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 getPicUrl() {
 return PicUrl;
 }
 public void setPicUrl(String picUrl) {
 PicUrl = picUrl;
 }
 public String getUrl() {
 return Url;
 }
 public void setUrl(String url) {
 Url = url;
 }
}

10??: com.wtz.message? ????. ?? ???, ? ??? NewsMessage.java ??

package com.wtz.message.response;

import java.util.List;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午10:16:22
 * <p>version:1.0</p>
 * <p>description:圖文消息類</p>
 */
public class NewsMessage extends BaseMessage{
 //圖文條數(shù)
 private int ArticleCount;
 //多條圖文消息信息,默認(rèn)第一個item為大圖
 private List<Article> Articles;
 
 public int getArticleCount() {
 return ArticleCount;
 }
 public void setArticleCount(int articleCount) {
 ArticleCount = articleCount;
 }
 public List<Article> getArticles() {
 return Articles;
 }
 public void setArticles(List<Article> articles) {
 Articles = articles;
 }
}

11??: ? ??? com.wtz.message.request, ? ??? BaseMessage.java

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午10:53:23
 * <p>version:1.0</p>
 * <p>description:請求消息基類(普通用戶->公眾賬號)</p>
 * <p>站在服務(wù)器端的視角:接收信息</p>
 */
public class BaseMessage {
 //開發(fā)者微信號
 private String ToUserName;
 //發(fā)送方賬號(一個OpenId)
 private String FromUserName;
 //消息創(chuàng)建時間(整型)
 private long CreateTime;
 //消息類型
 private String MsgType;
 //消息ID,64位整型
 private long MsgId;
 
 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 long getMsgId() {
 return MsgId;
 }
 public void setMsgId(long msgId) {
 MsgId = msgId;
 }
}

12??: com.wtz.message .request ??? ??, ? ??? TextMessage.java ???

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午11:04:35
 * <p>version:1.0</p>
 * <p>description:文本消息</p>
 */
public class TextMessage extends BaseMessage{
 //消息內(nèi)容
 private String Content;

 public String getContent() {
 return Content;
 }

 public void setContent(String content) {
 Content = content;
 }
}

13??: com.wtz.message.request ??? ?? , ? ??? ImageMessage.java ???

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午11:20:50
 * <p>version:1.0</p>
 * <p>description:圖片消息</p>
 */
public class ImageMessage extends BaseMessage{
 //圖片鏈接
 private String PicUrl;
 //圖片消息媒體ID
 private String MediaId;
 
 public String getPicUrl() {
 return PicUrl;
 }
 public void setPicUrl(String picUrl) {
 PicUrl = picUrl;
 }
 public String getMediaId() {
 return MediaId;
 }
 public void setMediaId(String mediaId) {
 MediaId = mediaId;
 }
}

14??: com.wtz.message.request ???? ?? ? ??? VoiceMessage.java

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午11:27:40
 * <p>version:1.0</p>
 * <p>description:語音消息類</p>
 */
public class VoiceMessage extends BaseMessage {
 //媒體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;
 }
}

< ??? ??>15??: com.wtz.message.?? ???? ?? ? ??? VideoMessage.java ???

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午3:28:03
 * <p>version:1.0</p>
 * <p>description:視頻消息類</p>
 */
public class VideoMessage extends BaseMessage {
 //視頻消息媒體ID
 private String MediaId;
 //視頻消息縮略圖的媒體ID
 private String ThumbMediaId;
 
 public String getMediaId() {
 return MediaId;
 }
 public void setMediaId(String mediaId) {
 MediaId = mediaId;
 }
 public String getThumbMediaId() {
 return ThumbMediaId;
 }
 public void setThumbMediaId(String thumbMediaId) {
 ThumbMediaId = thumbMediaId;
 }
}

16??: com.wtz.message.request ?? ???, ? ??? LocatonMessage.java ???

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午3:27:40
 * <p>version:1.0</p>
 * <p>description:地理位置消息類</p>
 */
public class LocationMessage extends BaseMessage {
 //地理位置緯度
 private String Location_X;
 //地理位置經(jīng)度
 private String Location_Y;
 //地圖縮放大小
 private String Scale;
 //地理位置信息
 private String Label;
 
 public String getLocation_X() {
 return Location_X;
 }
 public void setLocation_X(String location_X) {
 Location_X = location_X;
 }
 public String getLocation_Y() {
 return Location_Y;
 }
 public void setLocation_Y(String location_Y) {
 Location_Y = location_Y;
 }
 public String getScale() {
 return Scale;
 }
 public void setScale(String scale) {
 Scale = scale;
 }
 public String getLabel() {
 return Label;
 }
 public void setLabel(String label) {
 Label = label;
 }
}

17??: com.wtz.message.request ???? ?? ? ??? LinkMessage.java

package com.wtz.message.request;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午1:58:04
 * <p>version:1.0</p>
 * <p>description:鏈接消息類</p>
 */
public class LinkMessage extends BaseMessage {
 //消息標(biāo)題
 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;
 }
}

???

18??: ? ??? com.wtz.message? ???, ? ??? BaseEventMessage.java? ????.

package com.wtz.message.event;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 上午10:44:09
 * <p>version:1.0</p>
 * <p>description:基礎(chǔ)事件消息類</p>
 */
public class BaseEventMessage {
 //開發(fā)者微信號
 private String ToUserName;
 //發(fā)送方賬號(一個OpenID)
 private String FromUserName;
 //消息創(chuàng)建時間(整型)
 private long CreateTime;
 //消息類型
 private String MsgType;
 //事件類型
 private String Event;
 
 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 String getEvent() {
 return Event;
 }
 public void setEvent(String event) {
 Event = event;
 }
}

19??: com.wtz ??? ?? .message.event, ? ??? QRCodeEventMessage.java ???

package com.wtz.message.event;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午3:24:30
 * <p>version:1.0</p>
 * <p>description:掃描帶參數(shù)二維碼事件類</p>
 */
public class QRCodeEventMessage extends BaseEventMessage{
 //事件Key值
 private String EventKey;
 //用于換取二維碼圖片
 private String Ticket;
 
 public String getEventKey() {
 return EventKey;
 }
 public void setEventKey(String eventKey) {
 EventKey = eventKey;
 }
 public String getTicket() {
 return Ticket;
 }
 public void setTicket(String ticket) {
 Ticket = ticket;
 } 
}

20??: com.wtz.message.event ???? ?? ? ??? SubscribeEventMessage.java

package com.wtz.message.event;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午3:27:11
 * <p>version:1.0</p>
 * <p>description:關(guān)注/取消關(guān)注事件類</p>
 */
public class SubscribeEventMessage extends BaseEventMessage{
 
}
???

21??: com.wtz.message.event ???? ??, ? ??? MenuEventMessage.java? ????.

package com.wtz.message.event;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午3:32:42
 * <p>version:1.0</p>
 * <p>description:自定義菜單事件類</p>
 */
public class MenuEventMessage extends BaseEventMessage{
 //事件Key值,與自定義菜單接口中Key值對應(yīng)
 private String EventKey;

 public String getEventKey() {
 return EventKey;
 }

 public void setEventKey(String eventKey) {
 EventKey = eventKey;
 }
}

22??: com ??? ?? .wtz.message.event, ? ??? LocationEventMessage.java ??

package com.wtz.message.event;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月20日 下午3:37:50
 * <p>version:1.0</p>
 * <p>description:上報地理位置事件類</p>
 */
public class LocationEventMessage extends BaseEventMessage{
 //地理位置緯度
 private String Latitude;
 //地理位置經(jīng)度
 private String Longitude;
 //地理位置精度
 private String Precision;
 
 public String getLatitude() {
 return Latitude;
 }
 public void setLatitude(String latitude) {
 Latitude = latitude;
 }
 public String getLongitude() {
 return Longitude;
 }
 public void setLongitude(String longitude) {
 Longitude = longitude;
 }
 public String getPrecision() {
 return Precision;
 }
 public void setPrecision(String precision) {
 Precision = precision;
 }
}

23??: com.wtz.util ????? MessageUtil.java ???? ?? ? ???? ???? ?? ?? ? ??? ?? ??? ??? ?? ? ??? ??? ???? XML?? ???

package com.wtz.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.core.util.QuickWriter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
import com.thoughtworks.xstream.io.xml.XppDriver;
import com.wtz.message.response.ImageMessage;
import com.wtz.message.response.MusicMessage;
import com.wtz.message.response.NewsMessage;
import com.wtz.message.response.TextMessage;
import com.wtz.message.response.VideoMessage;
import com.wtz.message.response.VoiceMessage;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月19日 下午3:29:58
 * <p>version:1.0</p>
 * <p>description:消息處理工具類</p>
 */
public class MessageUtil {
 //請求消息類型:文本
 public static final String REQ_MESSAGE_TYPE_TEXT = "text";
 //請求消息類型:圖片
 public static final String REQ_MESSAGE_TYPE_IMAGE = "image";
 //請求消息類型:語音
 public static final String REQ_MESSAGE_TYPE_VOICE = "voice";
 //請求消息類型:視頻
 public static final String REQ_MESSAGE_TYPE_VIDEO = "video";
 //請求消息類型:地理位置
 public static final String REQ_MESSAGE_TYPE_LOCATION = "location";
 //請求消息類型:鏈接
 public static final String REQ_MESSAGE_TYPE_LINK = "link";
 //請求消息類型:事件推送
 public static final String REQ_MESSAGE_TYPE_EVENT = "event";
 
 //---------------------------------------------------------------
 
 //事件類型:subscribe(訂閱)
 public static final String EVENT_TYPE_SUBSCRIBE = "subscribe";
 //事件類型:unsubscribe(取消訂閱)
 public static final String EVENT_TYPE_UNSUBSCRIBE = "unsubscribe";
 //事件類型:scan(用戶已關(guān)注時的掃描帶參數(shù)的二維碼)
 public static final String EVENT_TYPE_SCAN = "scan";
 //事件類型:LOCATION(上報地理位置)
 public static final String EVENT_TYPE_LOCATION = "LOCATION";
 //事件類型:CLICK(自定義菜單)
 public static final String EVENT_TYPE_CLICK = "CLICK";
 
 //---------------------------------------------------------------
 
 //響應(yīng)消息類型:文本
 public static final String RESP_MESSAGE_TYPE_TEXT = "text";
 //響應(yīng)詳細(xì)類型:圖片
 public static final String RESP_MESSAGE_TYPE_IMAGE = "image";
 //響應(yīng)消息類型:語音
 public static final String RESP_MESSAGE_TYPE_VOICE = "voice";
 //響應(yīng)消息類型:視頻
 public static final String RESP_MESSAGE_TYPE_VIDEO = "video";
 //響應(yīng)詳細(xì)類型:音樂
 public static final String RESP_MESSAGE_TYPE_MUSIC = "music";
 //響應(yīng)消息類型:圖文
 public static final String RESP_MESSAGE_TYPE_NEWS = "news";
 
 //---------------------------------------------------------------
 
 //從流中解析出每個節(jié)點的內(nèi)容
 public static Map<String,String> parseXml(HttpServletRequest request) throws IOException{
 Map<String,String> map = new HashMap<String,String>();
 
 //從輸入流中獲取流對象
 InputStream in = request.getInputStream();
 
 //構(gòu)建SAX閱讀器對象
 SAXReader reader = new SAXReader();
 try {
  //從流中獲得文檔對象
  Document doc = reader.read(in);
  
  //獲得根節(jié)點
  Element root = doc.getRootElement();
  
  //獲取根節(jié)點下的所有子節(jié)點
  List<Element> children = root.elements();
  
  for(Element e:children){
  //遍歷每一個節(jié)點,并按照節(jié)點名--節(jié)點值放入map中
  map.put(e.getName(), e.getText());
  System.out.println("用戶發(fā)送的消息XML解析為:" + e.getName() + e.getText());
  }
  
  //關(guān)閉流
  in.close();
  in = null;
 } catch (DocumentException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }
 
 return map;
 }
 
 /**
 * 用于擴(kuò)展節(jié)點數(shù)據(jù)按照<ToUserName><![CDATA[toUser]]></ToUserName>,中間加了CDATA段
 */
 private static XStream xstream = new XStream(new XppDriver(){
 public HierarchicalStreamWriter createWriter(Writer out){
  return new PrettyPrintWriter(out){
  boolean cdata = true;
  public void startNode(String name,Class clazz){
   super.startNode(name,clazz);
  }
  
  protected void writeText(QuickWriter writer,String text){
   if(cdata){
   writer.write("<![CDATA[");
   writer.write(text);
   writer.write("]]>");
   }else{
   writer.write(text);
   }
  }
  };
 }
 });
 
 /**
 * 將文本消息對象轉(zhuǎn)換成XML格式
 * params:textMessage 文本消息對象
 * return:xml
 */
 public static String messageToXml(TextMessage textMessage){
 xstream.alias("xml",textMessage.getClass());
 return xstream.toXML(textMessage);
 }
 
 /**
 * 將圖片消息對象轉(zhuǎn)換成XML格式
 * params:imageMessage
 * return:xml
 */
 public static String messageToXml(ImageMessage imageMessage){
 xstream.alias("xml", imageMessage.getClass());
 return xstream.toXML(imageMessage);
 }
 
 /**
 * 將語音消息對象轉(zhuǎn)換成XML格式
 * params:voiceMessage
 * return:xml
 */
 public static String messageToXml(VoiceMessage voiceMessage){
 xstream.alias("xml",voiceMessage.getClass());
 return xstream.toXML(voiceMessage);
 }
 
 /**
 * 將視頻消息對象轉(zhuǎn)換成XML格式
 * params:videoMessage
 * return:xml
 */
 public static String messageToXml(VideoMessage videoMessage){
 xstream.alias("xml",videoMessage.getClass());
 return xstream.toXML(videoMessage);
 }
 
 /**
 * 將音樂消息對象轉(zhuǎn)換成XML格式
 * params:musicMessage
 * return:xml
 */
 public static String messageToXml(MusicMessage musicMessage){
 xstream.alias("xml",musicMessage.getClass());
 return xstream.toXML(musicMessage);
 }
 
 /**
 * 將圖文消息對象轉(zhuǎn)換成XML格式
 * params:newsMessage
 * return:xml
 */
 public static String messageToXml(NewsMessage newsMessage){
 xstream.alias("xml",newsMessage.getClass());
 return xstream.toXML(newsMessage);
 }
}

? ??? ??? ??? ???? ?????. 24??: ProcessService.java ?? com.wtz.util ??? ?? ???? ??? ??? ??? ???? ????? dealRequest ???? ?????.

package com.wtz.util;

import java.io.IOException;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.wtz.message.response.TextMessage;

/**
 * @author wangtianze QQ:864620012
 * @date 2017年4月19日 下午8:04:14
 * <p>version:1.0</p>
 * <p>description:核心服務(wù)類</p>
 */
public class ProcessService {
 public static String dealRequest(HttpServletRequest request){
 //XML格式的消息數(shù)據(jù)
 String respXml = "";
 //默認(rèn)返回的文本消息內(nèi)容
 String respContent = "未知的消息類型";
 //調(diào)用parseXml方法解析請求消息
 Map<String, String> requestMap;
 try {
  requestMap = MessageUtil.parseXml(request);
  //發(fā)送方賬號
  String fromUserName = requestMap.get("FromUserName");
  //開發(fā)者微信號
  String toUserName = requestMap.get("ToUserName");
  //消息類型
  String MsgType = requestMap.get("MsgType");
  
  //回復(fù)文本消息
  TextMessage textMessage = new TextMessage();
  textMessage.setToUserName(fromUserName);
  textMessage.setFromUserName(toUserName);
  textMessage.setCreateTime(new Date().getTime());
  textMessage.setMsgType(MessageUtil.RESP_MESSAGE_TYPE_TEXT);
  
  if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_TEXT)){
  respContent = "您發(fā)送的是文本消息";
  }else if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_IMAGE)){
  respContent = "您發(fā)送的是圖片消息";
  }else if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_VOICE)){
  respContent = "您發(fā)送的是語音消息";
  }else if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_VIDEO)){
  respContent = "您發(fā)送的是視頻消息";
  }else if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_LOCATION)){
  respContent = "您發(fā)送的是地理位置消息";
  }else if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_LINK)){
  respContent = "您發(fā)送的是鏈接消息";
  }else if(MsgType.equals(MessageUtil.REQ_MESSAGE_TYPE_EVENT)){
  //事件類型
  String eventType = requestMap.get("Event");
  if(eventType.equals(MessageUtil.EVENT_TYPE_SUBSCRIBE)){
   respContent = "感謝您的關(guān)注";
  }else if(eventType.equals(MessageUtil.EVENT_TYPE_UNSUBSCRIBE)){
   //TODO 取消訂閱后用戶不會再收到公眾號發(fā)送的消息,因此不需要回復(fù)
  }else if(eventType.equals(MessageUtil.EVENT_TYPE_SCAN)){
   //TODO 處理掃描帶參數(shù)二維碼事件
  }else if(eventType.equals(MessageUtil.EVENT_TYPE_LOCATION)){
   //TODO 處理上報地理位置事件
  }else if(eventType.equals(MessageUtil.EVENT_TYPE_CLICK)){
   //TODO 處理菜單點擊事件
  }
  }
  //設(shè)置文本消息的內(nèi)容
  textMessage.setContent(respContent);
  //將文本消息對象轉(zhuǎn)換成xml
  respXml = MessageUtil.messageToXml(textMessage);
 } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }
 
 return respXml;
 }
}
??? ??? ???? ??????.

[?? ??]

1.

?? ???? ??? ???? ????

2.?? ?? ????

? ??? WeChat ?? ??? ?? ??? ??? ??? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
JDBC? Java? ??? ???? ??? ?????? JDBC? Java? ??? ???? ??? ?????? Aug 02, 2025 pm 12:29 PM

JDBC ????? ???? ????? ?? ?? ?? ??? ?? ?? ??? ?? ? ?? ??? ?? ?? ?? ??? ???????. 1. ????? ????? Conn.SetAutoCommit (False)?? ??????. 2. ??? ? ????? ?? ?? SQL ??? ?????. 3. ?? ??? ??? ?? Conn.commit ()?? ???? ??? ???? ???? ?? ??? ???? Conn.Rollback ()?? ??????. ???, ? ??? ???? ????, ??? ???? ????, ?? ??? ??? ?? ??? ??? ???? ? ???????. ?? ?? ?? ???? ????? ??? ???? ?? ?? ???? ???? ??? ????? ?? ??? ??? ? ?? ???? ?? ????.

Java? ??? ?? ??? ?????? Java? ??? ?? ??? ?????? Aug 02, 2025 am 02:38 AM

?? ?? ? ?? ???? ???? ?? Java.Time ???? ???? ??????. 2. LocalDate, LocalDateTime ? LocalTime? ?? ?? ??? ??? ?????. 3. () ???? ???? ?? ??? ??? ????. 4. ???/???? ??? ???? ??? ????? ??? ??????. 5. ZonedDateTime ? Zoneid? ???? ???? ??????. 6. DateTimeFormatter? ?? ?? ? ?? ?? ?? ???; 7. ??? ?? ?? ?? ??? ????? ?? ??????. ?? Java? ?? ??? ???? ??? ??? ???? Java.Timeapi ??? ?? ??? ???????.

Java ??? ?? ?? : Spring Boot vs Quarkus vs Micronaut Java ??? ?? ?? : Spring Boot vs Quarkus vs Micronaut Aug 04, 2025 pm 12:48 PM

Pre-FormancetArtUptimeMoryUsage, Quarkusandmicronautleadduetocompile-timeprocessingandgraalvsupport, withquarkusoftenperforminglightbetterine serverless sinarios.2.thyvelopecosyste,

??? ??? Java?? ??? ?????? ??? ??? Java?? ??? ?????? Aug 02, 2025 pm 01:55 PM

Java 's Garbage Collection (GC)? ???? ???? ???? ??????, ?? ? ??? ??? ? ??? ??? ??? ??? ????. 1.GC? ?? ?? (? : ?? ??, ?? ???, ?? ?? ?)?? ??? ???? ????, ?? ? ??? ??? ???? ?????. 2. ?? ???? ????? ????, ?? ?? ??? ??? ???? ?? ??? ??????. 3. ?? ?? ?? ?? : ??? ?? (Eden, S0, S1)? ?? ????? ?????. ??? ??? ?? ? MajorGC? ???? ? ??? ? ????. Metaspace? ??? ?? ???? ?????. 4. JVM? ??? GC ??? ?????. SerialGC? ??? ?? ????? ?????. ParallelGC? ???? ??????. CMS? ?? ???

Java ?? ?? ?? : Maven vs. Gradle Java ?? ?? ?? : Maven vs. Gradle Aug 03, 2025 pm 01:36 PM

GradleisBetTerChoiceFormostNewProjectSduetoitssuperiorflexible, Performance, and ModernToolingsupport.1.Gradle'Sgroovy/kotlindslismoreConcisENDEXPRESSIVETHANMAVEN'SVOSEXML.2.GradleOutsMaveninbuildweedweedweedweedweedweedweedweedweedweedweedweedweedweede

??? ????. ?? ??? ?? ??? ????. ?? ??? ?? Aug 02, 2025 am 06:26 AM

DEFER? ??? ???? ?? ??? ??? ???? ? ?????. ?? ??? ?? ? ? ?? ????, ??? ??? ? ?? ?? (LIFO)? ??? ?????. 1. ?? ??? ??? ? ??? ?????. 2. ?? ??? ?? ??? ??? ????? ?????. 3. ?? ? ?? ?? ??? ? ????. 4. ??? ?????? ??? ??? ???? ?????. 5. ?? ??? ???? ?? ??? ?? ??? ?????. ??? ??? ?? ?? ? ???? ???? ? ????.

??? ???? html` ?? '??? ????? ??? ???? html` ?? '??? ????? Aug 03, 2025 am 11:07 AM

??? htmlinput ??? ???? ??? ???? ????? ??? ??? ?? ??? ???? ???? ? ????. 1. ???, ???, ??, ?? ? ??? ?? ??? ??? ?? ?? ?? ??? ???? ???? ??? ? ???? ??? ? ????. 2. HTML5? ?????? ??? ? ?? ?? ??? ?? ? ??? URL, ??, ?? ? ??? ?? ??? ??? ??????. 3. ?? ?? ? ? ??? ??? ???? ?? ??? ???? ???? ?? ???? ?? ???? ???? ?? ? ? ??? ?? ???????.

?? HTTP ???? ?? ??? ?????? ?? HTTP ???? ?? ??? ?????? Aug 03, 2025 am 11:35 AM

GO? HTTP ?? ????? ?? ??, ??, ????? IP ? ?? ??? ?? ? ? ????. 1. http.handlerfunc? ???? ????? ????, 2. ??? ???? ?? ?? ??? ?? ??? ??????. ?? ?? ??? ???? ??? ?????? ??? ????? ???? ? ?????. ?? ???? ?? ?? ??, JSON ?? ?? ? ?? ID ??? ?????.

See all articles