Skip to content

Commit 912ef62

Browse files
committed
重构客服消息相关命名,替换不合理的命名:CustomMessage -> KefuMessage
1 parent 585cee0 commit 912ef62

21 files changed

+125
-137
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpKefuService.java

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

3-
import java.io.File;
4-
import java.util.Date;
5-
63
import me.chanjar.weixin.common.exception.WxErrorException;
7-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
85
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
9-
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
10-
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList;
11-
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
12-
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
13-
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
14-
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;
6+
import me.chanjar.weixin.mp.bean.kefu.result.*;
7+
8+
import java.io.File;
9+
import java.util.Date;
1510

1611
/**
1712
* 客服接口 ,
@@ -29,7 +24,7 @@ public interface WxMpKefuService {
2924
* 详情请见: <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547&token=&lang=zh_CN">发送客服消息</a>
3025
* </pre>
3126
*/
32-
boolean customMessageSend(WxMpCustomMessage message) throws WxErrorException;
27+
boolean sendKefuMessage(WxMpKefuMessage message) throws WxErrorException;
3328

3429
//*******************客服管理接口***********************//
3530

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.File;
44
import java.util.Date;
55

6+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
67
import org.slf4j.Logger;
78
import org.slf4j.LoggerFactory;
89

@@ -14,7 +15,6 @@
1415
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
1516
import me.chanjar.weixin.mp.api.WxMpKefuService;
1617
import me.chanjar.weixin.mp.api.WxMpService;
17-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
1818
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
1919
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest;
2020
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
@@ -41,7 +41,7 @@ public WxMpKefuServiceImpl(WxMpService wxMpService) {
4141
}
4242

4343
@Override
44-
public boolean customMessageSend(WxMpCustomMessage message)
44+
public boolean sendKefuMessage(WxMpKefuMessage message)
4545
throws WxErrorException {
4646
String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
4747
String responseContent = this.wxMpService.post(url, message.toJson());
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
77

88
@XStreamAlias("xml")
9-
public class WxMpXmlOutTransferCustomerServiceMessage extends WxMpXmlOutMessage {
9+
public class WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage {
1010
private static final long serialVersionUID = 1850903037285841322L;
11-
11+
1212
@XStreamAlias("TransInfo")
1313
protected TransInfo transInfo;
1414

15-
public WxMpXmlOutTransferCustomerServiceMessage() {
15+
public WxMpXmlOutTransferKefuMessage() {
1616
this.msgType = WxConsts.CUSTOM_MSG_TRANSFER_CUSTOMER_SERVICE;
1717
}
1818

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/BaseBuilder.java

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

3-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
3+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
44

55
public class BaseBuilder<T> {
66
protected String msgType;
@@ -11,8 +11,8 @@ public T toUser(String toUser) {
1111
return (T) this;
1212
}
1313

14-
public WxMpCustomMessage build() {
15-
WxMpCustomMessage m = new WxMpCustomMessage();
14+
public WxMpKefuMessage build() {
15+
WxMpKefuMessage m = new WxMpKefuMessage();
1616
m.setMsgType(this.msgType);
1717
m.setToUser(this.toUser);
1818
return m;

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/ImageBuilder.java

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

33
import me.chanjar.weixin.common.api.WxConsts;
4-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
55

66
/**
77
* 获得消息builder
88
* <pre>
9-
* 用法: WxMpCustomMessage m = WxMpCustomMessage.IMAGE().mediaId(...).toUser(...).build();
9+
* 用法: WxMpKefuMessage m = WxMpKefuMessage.IMAGE().mediaId(...).toUser(...).build();
1010
* </pre>
1111
* @author chanjarster
1212
*
@@ -24,8 +24,8 @@ public ImageBuilder mediaId(String media_id) {
2424
}
2525

2626
@Override
27-
public WxMpCustomMessage build() {
28-
WxMpCustomMessage m = super.build();
27+
public WxMpKefuMessage build() {
28+
WxMpKefuMessage m = super.build();
2929
m.setMediaId(this.mediaId);
3030
return m;
3131
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/MusicBuilder.java

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

33
import me.chanjar.weixin.common.api.WxConsts;
4-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
55

66
/**
77
* 音乐消息builder
88
* <pre>
9-
* 用法: WxMpCustomMessage m = WxMpCustomMessage.MUSIC()
9+
* 用法: WxMpKefuMessage m = WxMpKefuMessage.MUSIC()
1010
* .musicUrl(...)
1111
* .hqMusicUrl(...)
1212
* .title(...)
@@ -53,8 +53,8 @@ public MusicBuilder thumbMediaId(String thumb_media_id) {
5353
}
5454

5555
@Override
56-
public WxMpCustomMessage build() {
57-
WxMpCustomMessage m = super.build();
56+
public WxMpKefuMessage build() {
57+
WxMpKefuMessage m = super.build();
5858
m.setMusicUrl(this.musicUrl);
5959
m.setHqMusicUrl(this.hqMusicUrl);
6060
m.setTitle(this.title);

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/NewsBuilder.java

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

33
import me.chanjar.weixin.common.api.WxConsts;
4-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
55

66
import java.util.ArrayList;
77
import java.util.List;
@@ -10,27 +10,27 @@
1010
* 图文消息builder
1111
* <pre>
1212
* 用法:
13-
* WxMpCustomMessage m = WxMpCustomMessage.NEWS().addArticle(article).toUser(...).build();
13+
* WxMpKefuMessage m = WxMpKefuMessage.NEWS().addArticle(article).toUser(...).build();
1414
* </pre>
1515
* @author chanjarster
1616
*
1717
*/
1818
public final class NewsBuilder extends BaseBuilder<NewsBuilder> {
1919

20-
private List<WxMpCustomMessage.WxArticle> articles = new ArrayList<>();
21-
20+
private List<WxMpKefuMessage.WxArticle> articles = new ArrayList<>();
21+
2222
public NewsBuilder() {
2323
this.msgType = WxConsts.CUSTOM_MSG_NEWS;
2424
}
2525

26-
public NewsBuilder addArticle(WxMpCustomMessage.WxArticle article) {
26+
public NewsBuilder addArticle(WxMpKefuMessage.WxArticle article) {
2727
this.articles.add(article);
2828
return this;
2929
}
3030

3131
@Override
32-
public WxMpCustomMessage build() {
33-
WxMpCustomMessage m = super.build();
32+
public WxMpKefuMessage build() {
33+
WxMpKefuMessage m = super.build();
3434
m.setArticles(this.articles);
3535
return m;
3636
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/TextBuilder.java

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

33
import me.chanjar.weixin.common.api.WxConsts;
4-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
55

66
/**
77
* 文本消息builder
88
* <pre>
9-
* 用法: WxMpCustomMessage m = WxMpCustomMessage.TEXT().content(...).toUser(...).build();
9+
* 用法: WxMpKefuMessage m = WxMpKefuMessage.TEXT().content(...).toUser(...).build();
1010
* </pre>
1111
* @author chanjarster
1212
*
@@ -24,8 +24,8 @@ public TextBuilder content(String content) {
2424
}
2525

2626
@Override
27-
public WxMpCustomMessage build() {
28-
WxMpCustomMessage m = super.build();
27+
public WxMpKefuMessage build() {
28+
WxMpKefuMessage m = super.build();
2929
m.setContent(this.content);
3030
return m;
3131
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VideoBuilder.java

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

33
import me.chanjar.weixin.common.api.WxConsts;
4-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
55

66
/**
77
* 视频消息builder
88
* <pre>
9-
* 用法: WxMpCustomMessage m = WxMpCustomMessage.VOICE()
9+
* 用法: WxMpKefuMessage m = WxMpKefuMessage.VOICE()
1010
* .mediaId(...)
1111
* .title(...)
1212
* .thumbMediaId(..)
@@ -48,8 +48,8 @@ public VideoBuilder thumbMediaId(String thumb_media_id) {
4848
}
4949

5050
@Override
51-
public WxMpCustomMessage build() {
52-
WxMpCustomMessage m = super.build();
51+
public WxMpKefuMessage build() {
52+
WxMpKefuMessage m = super.build();
5353
m.setMediaId(this.mediaId);
5454
m.setTitle(this.title);
5555
m.setDescription(this.description);

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VoiceBuilder.java

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

33
import me.chanjar.weixin.common.api.WxConsts;
4-
import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
4+
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
55

66
/**
77
* 语音消息builder
88
* <pre>
9-
* 用法: WxMpCustomMessage m = WxMpCustomMessage.VOICE().mediaId(...).toUser(...).build();
9+
* 用法: WxMpKefuMessage m = WxMpKefuMessage.VOICE().mediaId(...).toUser(...).build();
1010
* </pre>
1111
* @author chanjarster
1212
*
@@ -24,8 +24,8 @@ public VoiceBuilder mediaId(String media_id) {
2424
}
2525

2626
@Override
27-
public WxMpCustomMessage build() {
28-
WxMpCustomMessage m = super.build();
27+
public WxMpKefuMessage build() {
28+
WxMpKefuMessage m = super.build();
2929
m.setMediaId(this.mediaId);
3030
return m;
3131
}

0 commit comments

Comments
 (0)