Skip to content

Commit 2c96d54

Browse files
committed
polish code
1 parent f76f0e6 commit 2c96d54

31 files changed

Lines changed: 145 additions & 220 deletions

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpConsts.java renamed to weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxConsts.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package me.chanjar.weixin.mp.api;
1+
package me.chanjar.weixin.common.api;
22

33
import java.util.HashMap;
44
import java.util.Map;
55

6-
public class WxMpConsts {
6+
public class WxConsts {
77

88
///////////////////////
99
// 微信推送过来的消息的类型,和发送给微信xml格式消息的消息类型
@@ -20,14 +20,15 @@ public class WxMpConsts {
2020
public static final String XML_TRANSFER_CUSTOMER_SERVICE = "transfer_customer_service";
2121

2222
///////////////////////
23-
// 客服消息的消息类型
23+
// 主动发送消息的消息类型
2424
///////////////////////
2525
public static final String CUSTOM_MSG_TEXT = "text";
2626
public static final String CUSTOM_MSG_IMAGE = "image";
2727
public static final String CUSTOM_MSG_VOICE = "voice";
2828
public static final String CUSTOM_MSG_VIDEO = "video";
2929
public static final String CUSTOM_MSG_MUSIC = "music";
3030
public static final String CUSTOM_MSG_NEWS = "news";
31+
public static final String CUSTOM_MSG_FILE = "file";
3132

3233
///////////////////////
3334
// 群发消息的消息类型
@@ -95,6 +96,7 @@ public class WxMpConsts {
9596
public static final String MEDIA_VOICE = "voice";
9697
public static final String MEDIA_VIDEO = "video";
9798
public static final String MEDIA_THUMB = "thumb";
99+
public static final String MEDIA_FILE = "file";
98100

99101
///////////////////////
100102
// 文件类型

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

Lines changed: 0 additions & 81 deletions
This file was deleted.

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public interface WxMpService {
5555
*
5656
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
5757
* </pre>
58-
* @param mediaType 媒体类型, 请看{@link WxMpConsts}
59-
* @param fileType 文件类型,请看{@link WxMpConsts}
58+
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
59+
* @param fileType 文件类型,请看{@link me.chanjar.weixin.common.api.WxConsts}
6060
* @param inputStream 输入流
6161
* @throws WxErrorException
6262
*/

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpCustomMessage.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public String getMsgType() {
3737
/**
3838
* <pre>
3939
* 请使用
40-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#CUSTOM_MSG_TEXT}
41-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#CUSTOM_MSG_IMAGE}
42-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#CUSTOM_MSG_VOICE}
43-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#CUSTOM_MSG_MUSIC}
44-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#CUSTOM_MSG_VIDEO}
45-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#CUSTOM_MSG_NEWS}
40+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_TEXT}
41+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_IMAGE}
42+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VOICE}
43+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MUSIC}
44+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VIDEO}
45+
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_NEWS}
4646
* </pre>
4747
* @param msgType
4848
*/

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassGroupMessage.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public String getMsgtype() {
2525
/**
2626
* <pre>
2727
* 请使用
28-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_IMAGE}
29-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_NEWS}
30-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_TEXT}
31-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_VIDEO}
32-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_VOICE}
28+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_IMAGE}
29+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_NEWS}
30+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_TEXT}
31+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VIDEO}
32+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
3333
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
3434
* </pre>
3535
* @param msgtype

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassNews.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
*/
1313
public class WxMpMassNews {
1414

15-
private List<WxMassNewsArticle> articles = new ArrayList<WxMassNewsArticle>();
15+
private List<WxMpMassNewsArticle> articles = new ArrayList<WxMpMassNewsArticle>();
1616

17-
public List<WxMassNewsArticle> getArticles() {
17+
public List<WxMpMassNewsArticle> getArticles() {
1818
return articles;
1919
}
2020

21-
public void addArticle(WxMassNewsArticle article) {
21+
public void addArticle(WxMpMassNewsArticle article) {
2222
this.articles.add(article);
2323
}
2424

@@ -40,7 +40,7 @@ public String toJson() {
4040
* @author chanjarster
4141
*
4242
*/
43-
public static class WxMassNewsArticle {
43+
public static class WxMpMassNewsArticle {
4444
/**
4545
* (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得
4646
*/

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassOpenIdsMessage.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public String getMsgType() {
2828
/**
2929
* <pre>
3030
* 请使用
31-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_IMAGE}
32-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_NEWS}
33-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_TEXT}
34-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_VIDEO}
35-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#MASS_MSG_VOICE}
31+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_IMAGE}
32+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_NEWS}
33+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_TEXT}
34+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VIDEO}
35+
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
3636
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
3737
* </pre>
3838
* @param msgType

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMpXmlOutImageMessage.java‎

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

3+
import me.chanjar.weixin.common.api.WxConsts;
34
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller;
4-
import me.chanjar.weixin.mp.api.WxMpConsts;
55

66
import javax.xml.bind.annotation.XmlAccessType;
77
import javax.xml.bind.annotation.XmlAccessorType;
@@ -18,7 +18,7 @@ public class WxMpMpXmlOutImageMessage extends WxMpXmlOutMessage {
1818
private String mediaId;
1919

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

2424
public String getMediaId() {

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpXmlMessage.java‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ public void setCreateTime(Long createTime) {
179179
/**
180180
* <pre>
181181
* 当接受用户消息时,可能会获得以下值:
182-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_TEXT}
183-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_IMAGE}
184-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_VOICE}
185-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_VIDEO}
186-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_LOCATION}
187-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_LINK}
188-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_EVENT}
182+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
183+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
184+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
185+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
186+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LOCATION}
187+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LINK}
188+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_EVENT}
189189
* </pre>
190190
*
191191
* @return
@@ -197,12 +197,12 @@ public String getMsgType() {
197197
/**
198198
* <pre>
199199
* 当发送消息的时候使用:
200-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_TEXT}
201-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_IMAGE}
202-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_VOICE}
203-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_VIDEO}
204-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_NEWS}
205-
* {@link me.chanjar.weixin.mp.api.WxMpConsts#XML_MSG_MUSIC}
200+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT}
201+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE}
202+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE}
203+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO}
204+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_NEWS}
205+
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_MUSIC}
206206
* </pre>
207207
*
208208
* @param msgType

‎weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpXmlOutMewsMessage.java‎

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

3+
import me.chanjar.weixin.common.api.WxConsts;
34
import me.chanjar.weixin.common.util.xml.AdapterCDATA;
4-
import me.chanjar.weixin.mp.api.WxMpConsts;
55

66
import javax.xml.bind.annotation.*;
77
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -20,7 +20,7 @@ public class WxMpXmlOutMewsMessage extends WxMpXmlOutMessage {
2020
protected final List<Item> articles = new ArrayList<Item>();
2121

2222
public WxMpXmlOutMewsMessage() {
23-
this.msgType = WxMpConsts.XML_MSG_NEWS;
23+
this.msgType = WxConsts.XML_MSG_NEWS;
2424
}
2525

2626
public int getArticleCount() {

0 commit comments

Comments
 (0)