Skip to content

Commit 46e66d3

Browse files
committed
update
1 parent 30fe7a0 commit 46e66d3

15 files changed

Lines changed: 76 additions & 81 deletions

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public interface WxCpService {
6565
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
6666
* </pre>
6767
*
68-
* @param mediaType 媒体类型, 请看{@link WxCpConsts}
69-
* @param fileType 文件类型,请看{@link WxCpConsts}
68+
* @param mediaType 媒体类型, 请看{@link WxConsts}
69+
* @param fileType 文件类型,请看{@link WxConsts}
7070
* @param inputStream 输入流
7171
* @throws WxErrorException
7272
*/

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpMessage.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ public String getMsgType() {
6565
/**
6666
* <pre>
6767
* 请使用
68-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_TEXT}
69-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_IMAGE}
70-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_VOICE}
71-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_MUSIC}
72-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_VIDEO}
73-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_NEWS}
68+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_TEXT}
69+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_IMAGE}
70+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VOICE}
71+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MUSIC}
72+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VIDEO}
73+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_NEWS}
7474
* </pre>
7575
* @param msgType
7676
*/

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpXmlMessage.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ public void setCreateTime(Long createTime) {
190190
/**
191191
* <pre>
192192
* 当接受用户消息时,可能会获得以下值:
193-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_TEXT}
194-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_IMAGE}
195-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VOICE}
196-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VIDEO}
197-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_LOCATION}
198-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_LINK}
199-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_EVENT}
193+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
194+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
195+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
196+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
197+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LOCATION}
198+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LINK}
199+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_EVENT}
200200
* </pre>
201201
*
202202
* @return
@@ -208,11 +208,11 @@ public String getMsgType() {
208208
/**
209209
* <pre>
210210
* 当发送消息的时候使用:
211-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_TEXT}
212-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_IMAGE}
213-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VOICE}
214-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VIDEO}
215-
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_NEWS}
211+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
212+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
213+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
214+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
215+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_NEWS}
216216
* </pre>
217217
*
218218
* @param msgType

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpXmlOutImageMessage.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package me.chanjar.weixin.cp.bean;
22

3+
import me.chanjar.weixin.common.api.WxConsts;
4+
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
5+
36
import javax.xml.bind.annotation.XmlAccessType;
47
import javax.xml.bind.annotation.XmlAccessorType;
58
import javax.xml.bind.annotation.XmlElement;
69
import javax.xml.bind.annotation.XmlRootElement;
710
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
811

9-
import me.chanjar.weixin.cp.api.WxCpConsts;
10-
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
11-
1212
@XmlRootElement(name = "xml")
1313
@XmlAccessorType(XmlAccessType.FIELD)
1414
public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage {
@@ -18,7 +18,7 @@ public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage {
1818
private String mediaId;
1919

2020
public WxCpXmlOutImageMessage() {
21-
this.msgType = WxCpConsts.XML_MSG_IMAGE;
21+
this.msgType = WxConsts.XML_MSG_IMAGE;
2222
}
2323

2424
public String getMediaId() {

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpXmlOutMewsMessage.java‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
package me.chanjar.weixin.cp.bean;
22

3-
import java.util.ArrayList;
4-
import java.util.List;
3+
import me.chanjar.weixin.common.api.WxConsts;
4+
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
55

6-
import javax.xml.bind.annotation.XmlAccessType;
7-
import javax.xml.bind.annotation.XmlAccessorType;
8-
import javax.xml.bind.annotation.XmlElement;
9-
import javax.xml.bind.annotation.XmlElementWrapper;
10-
import javax.xml.bind.annotation.XmlRootElement;
6+
import javax.xml.bind.annotation.*;
117
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
12-
13-
import me.chanjar.weixin.cp.api.WxCpConsts;
14-
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
8+
import java.util.ArrayList;
9+
import java.util.List;
1510

1611
@XmlRootElement(name = "xml")
1712
@XmlAccessorType(XmlAccessType.FIELD)
@@ -25,7 +20,7 @@ public class WxCpXmlOutMewsMessage extends WxCpXmlOutMessage {
2520
protected final List<Item> articles = new ArrayList<Item>();
2621

2722
public WxCpXmlOutMewsMessage() {
28-
this.msgType = WxCpConsts.XML_MSG_NEWS;
23+
this.msgType = WxConsts.XML_MSG_NEWS;
2924
}
3025

3126
public int getArticleCount() {

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpXmlOutTextMessage.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.xml.bind.annotation.XmlRootElement;
77
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
88

9-
import me.chanjar.weixin.cp.api.WxCpConsts;
9+
import me.chanjar.weixin.common.api.WxConsts;
1010
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
1111

1212
@XmlRootElement(name = "xml")
@@ -18,7 +18,7 @@ public class WxCpXmlOutTextMessage extends WxCpXmlOutMessage {
1818
private String content;
1919

2020
public WxCpXmlOutTextMessage() {
21-
this.msgType = WxCpConsts.XML_MSG_TEXT;
21+
this.msgType = WxConsts.XML_MSG_TEXT;
2222
}
2323

2424
public String getContent() {

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpXmlOutVideoMessage.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.xml.bind.annotation.XmlRootElement;
77
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
88

9-
import me.chanjar.weixin.cp.api.WxCpConsts;
9+
import me.chanjar.weixin.common.api.WxConsts;
1010
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
1111

1212
@XmlRootElement(name = "xml")
@@ -17,7 +17,7 @@ public class WxCpXmlOutVideoMessage extends WxCpXmlOutMessage {
1717
protected final Video video = new Video();
1818

1919
public WxCpXmlOutVideoMessage() {
20-
this.msgType = WxCpConsts.XML_MSG_VIDEO;
20+
this.msgType = WxConsts.XML_MSG_VIDEO;
2121
}
2222

2323
public String getMediaId() {

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpXmlOutVoiceMessage.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.xml.bind.annotation.XmlRootElement;
77
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
88

9-
import me.chanjar.weixin.cp.api.WxCpConsts;
9+
import me.chanjar.weixin.common.api.WxConsts;
1010
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
1111

1212
@XmlRootElement(name = "xml")
@@ -18,7 +18,7 @@ public class WxCpXmlOutVoiceMessage extends WxCpXmlOutMessage {
1818
private String mediaId;
1919

2020
public WxCpXmlOutVoiceMessage() {
21-
this.msgType = WxCpConsts.XML_MSG_VOICE;
21+
this.msgType = WxConsts.XML_MSG_VOICE;
2222
}
2323

2424
public String getMediaId() {

‎weixin-java-cp/src/main/java/me/chanjar/weixin/cp/util/json/WxCpMessageGsonAdapter.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import java.lang.reflect.Type;
1212

13-
import me.chanjar.weixin.cp.api.WxCpConsts;
13+
import me.chanjar.weixin.common.api.WxConsts;
1414
import me.chanjar.weixin.cp.bean.WxCpMessage;
1515

1616
import com.google.gson.JsonArray;
@@ -41,31 +41,31 @@ public JsonElement serialize(WxCpMessage message, Type typeOfSrc, JsonSerializat
4141
if (StringUtils.isNotBlank(message.getToTag())) {
4242
messageJson.addProperty("totag", message.getToUser());
4343
}
44-
if (WxCpConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
44+
if (WxConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
4545
JsonObject text = new JsonObject();
4646
text.addProperty("content", message.getContent());
4747
messageJson.add("text", text);
4848
}
4949

50-
if (WxCpConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) {
50+
if (WxConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) {
5151
JsonObject image = new JsonObject();
5252
image.addProperty("media_id", message.getMediaId());
5353
messageJson.add("image", image);
5454
}
5555

56-
if (WxCpConsts.CUSTOM_MSG_FILE.equals(message.getMsgType())) {
56+
if (WxConsts.CUSTOM_MSG_FILE.equals(message.getMsgType())) {
5757
JsonObject image = new JsonObject();
5858
image.addProperty("media_id", message.getMediaId());
5959
messageJson.add("file", image);
6060
}
6161

62-
if (WxCpConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) {
62+
if (WxConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) {
6363
JsonObject voice = new JsonObject();
6464
voice.addProperty("media_id", message.getMediaId());
6565
messageJson.add("voice", voice);
6666
}
6767

68-
if (WxCpConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) {
68+
if (WxConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) {
6969
JsonObject video = new JsonObject();
7070
video.addProperty("media_id", message.getMediaId());
7171
video.addProperty("thumb_media_id", message.getThumbMediaId());
@@ -74,7 +74,7 @@ public JsonElement serialize(WxCpMessage message, Type typeOfSrc, JsonSerializat
7474
messageJson.add("video", video);
7575
}
7676

77-
if (WxCpConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) {
77+
if (WxConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) {
7878
JsonArray articleJsonArray = new JsonArray();
7979
for (WxCpMessage.WxArticle article : message.getArticles()) {
8080
JsonObject articleJson = new JsonObject();

‎weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpMediaAPITest.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public void testUploadMedia(String mediaType, String fileType, String fileName)
4949
@DataProvider
5050
public Object[][] uploadMedia() {
5151
return new Object[][] {
52-
new Object[] { WxCpConsts.MEDIA_IMAGE, WxCpConsts.FILE_JPG, "mm.jpeg" },
53-
new Object[] { WxCpConsts.MEDIA_VOICE, WxCpConsts.FILE_MP3, "mm.mp3" },
54-
new Object[] { WxCpConsts.MEDIA_VIDEO, WxCpConsts.FILE_MP4, "mm.mp4" },
55-
new Object[] { WxCpConsts.MEDIA_FILE, WxCpConsts.FILE_JPG, "mm.jpeg" }
52+
new Object[] { WxConsts.MEDIA_IMAGE, WxConsts.FILE_JPG, "mm.jpeg" },
53+
new Object[] { WxConsts.MEDIA_VOICE, WxConsts.FILE_MP3, "mm.mp3" },
54+
new Object[] { WxConsts.MEDIA_VIDEO, WxConsts.FILE_MP4, "mm.mp4" },
55+
new Object[] { WxConsts.MEDIA_FILE, WxConsts.FILE_JPG, "mm.jpeg" }
5656
};
5757
}
5858

0 commit comments

Comments
 (0)