1
0
mirror of synced 2025-12-22 09:58:07 +08:00
This commit is contained in:
Daniel Qian
2014-10-22 15:04:39 +08:00
parent 30fe7a0069
commit 46e66d333a
15 changed files with 76 additions and 81 deletions

View File

@@ -65,8 +65,8 @@ public interface WxCpService {
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
* </pre>
*
* @param mediaType 媒体类型, 请看{@link WxCpConsts}
* @param fileType 文件类型,请看{@link WxCpConsts}
* @param mediaType 媒体类型, 请看{@link WxConsts}
* @param fileType 文件类型,请看{@link WxConsts}
* @param inputStream 输入流
* @throws WxErrorException
*/

View File

@@ -65,12 +65,12 @@ public class WxCpMessage {
/**
* <pre>
* 请使用
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_TEXT}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_IMAGE}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_VOICE}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_MUSIC}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_VIDEO}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_NEWS}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_TEXT}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_IMAGE}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VOICE}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MUSIC}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VIDEO}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_NEWS}
* </pre>
* @param msgType
*/

View File

@@ -190,13 +190,13 @@ public class WxCpXmlMessage {
/**
* <pre>
* 当接受用户消息时,可能会获得以下值:
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_TEXT}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_IMAGE}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VOICE}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VIDEO}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_LOCATION}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_LINK}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_EVENT}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LOCATION}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LINK}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_EVENT}
* </pre>
*
* @return
@@ -208,11 +208,11 @@ public class WxCpXmlMessage {
/**
* <pre>
* 当发送消息的时候使用:
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_TEXT}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_IMAGE}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VOICE}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VIDEO}
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_NEWS}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_NEWS}
* </pre>
*
* @param msgType

View File

@@ -1,14 +1,14 @@
package me.chanjar.weixin.cp.bean;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import me.chanjar.weixin.cp.api.WxCpConsts;
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage {
@@ -18,7 +18,7 @@ public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage {
private String mediaId;
public WxCpXmlOutImageMessage() {
this.msgType = WxCpConsts.XML_MSG_IMAGE;
this.msgType = WxConsts.XML_MSG_IMAGE;
}
public String getMediaId() {

View File

@@ -1,18 +1,13 @@
package me.chanjar.weixin.cp.bean;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import me.chanjar.weixin.cp.api.WxCpConsts;
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class WxCpXmlOutMewsMessage extends WxCpXmlOutMessage {
@@ -25,7 +20,7 @@ public class WxCpXmlOutMewsMessage extends WxCpXmlOutMessage {
protected final List<Item> articles = new ArrayList<Item>();
public WxCpXmlOutMewsMessage() {
this.msgType = WxCpConsts.XML_MSG_NEWS;
this.msgType = WxConsts.XML_MSG_NEWS;
}
public int getArticleCount() {

View File

@@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import me.chanjar.weixin.cp.api.WxCpConsts;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@@ -18,7 +18,7 @@ public class WxCpXmlOutTextMessage extends WxCpXmlOutMessage {
private String content;
public WxCpXmlOutTextMessage() {
this.msgType = WxCpConsts.XML_MSG_TEXT;
this.msgType = WxConsts.XML_MSG_TEXT;
}
public String getContent() {

View File

@@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import me.chanjar.weixin.cp.api.WxCpConsts;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
@XmlRootElement(name = "xml")
@@ -17,7 +17,7 @@ public class WxCpXmlOutVideoMessage extends WxCpXmlOutMessage {
protected final Video video = new Video();
public WxCpXmlOutVideoMessage() {
this.msgType = WxCpConsts.XML_MSG_VIDEO;
this.msgType = WxConsts.XML_MSG_VIDEO;
}
public String getMediaId() {

View File

@@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import me.chanjar.weixin.cp.api.WxCpConsts;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
@XmlRootElement(name = "xml")
@@ -18,7 +18,7 @@ public class WxCpXmlOutVoiceMessage extends WxCpXmlOutMessage {
private String mediaId;
public WxCpXmlOutVoiceMessage() {
this.msgType = WxCpConsts.XML_MSG_VOICE;
this.msgType = WxConsts.XML_MSG_VOICE;
}
public String getMediaId() {

View File

@@ -10,7 +10,7 @@ package me.chanjar.weixin.cp.util.json;
import java.lang.reflect.Type;
import me.chanjar.weixin.cp.api.WxCpConsts;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.cp.bean.WxCpMessage;
import com.google.gson.JsonArray;
@@ -41,31 +41,31 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
if (StringUtils.isNotBlank(message.getToTag())) {
messageJson.addProperty("totag", message.getToUser());
}
if (WxCpConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
if (WxConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
JsonObject text = new JsonObject();
text.addProperty("content", message.getContent());
messageJson.add("text", text);
}
if (WxCpConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) {
if (WxConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) {
JsonObject image = new JsonObject();
image.addProperty("media_id", message.getMediaId());
messageJson.add("image", image);
}
if (WxCpConsts.CUSTOM_MSG_FILE.equals(message.getMsgType())) {
if (WxConsts.CUSTOM_MSG_FILE.equals(message.getMsgType())) {
JsonObject image = new JsonObject();
image.addProperty("media_id", message.getMediaId());
messageJson.add("file", image);
}
if (WxCpConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) {
if (WxConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) {
JsonObject voice = new JsonObject();
voice.addProperty("media_id", message.getMediaId());
messageJson.add("voice", voice);
}
if (WxCpConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) {
if (WxConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) {
JsonObject video = new JsonObject();
video.addProperty("media_id", message.getMediaId());
video.addProperty("thumb_media_id", message.getThumbMediaId());
@@ -74,7 +74,7 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> {
messageJson.add("video", video);
}
if (WxCpConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) {
if (WxConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) {
JsonArray articleJsonArray = new JsonArray();
for (WxCpMessage.WxArticle article : message.getArticles()) {
JsonObject articleJson = new JsonObject();