Skip to content

Commit d451d3b

Browse files
committed
优化代码
1 parent 113407a commit d451d3b

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
1212
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
1313

14+
import static me.chanjar.weixin.mp.enums.WxMpApiUrl.*;
15+
1416
/**
1517
* <pre>
1618
* 群发消息服务类
@@ -26,31 +28,31 @@ public class WxMpMassMessageServiceImpl implements WxMpMassMessageService {
2628

2729
@Override
2830
public WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException {
29-
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MEDIA_UPLOAD_NEWS_URL, news.toJson());
31+
String responseContent = this.wxMpService.post(MassMessage.MEDIA_UPLOAD_NEWS_URL, news.toJson());
3032
return WxMpMassUploadResult.fromJson(responseContent);
3133
}
3234

3335
@Override
3436
public WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException {
35-
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MEDIA_UPLOAD_VIDEO_URL, video.toJson());
37+
String responseContent = this.wxMpService.post(MassMessage.MEDIA_UPLOAD_VIDEO_URL, video.toJson());
3638
return WxMpMassUploadResult.fromJson(responseContent);
3739
}
3840

3941
@Override
4042
public WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException {
41-
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_SENDALL_URL, message.toJson());
43+
String responseContent = this.wxMpService.post(MassMessage.MESSAGE_MASS_SENDALL_URL, message.toJson());
4244
return WxMpMassSendResult.fromJson(responseContent);
4345
}
4446

4547
@Override
4648
public WxMpMassSendResult massOpenIdsMessageSend(WxMpMassOpenIdsMessage message) throws WxErrorException {
47-
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_SEND_URL, message.toJson());
49+
String responseContent = this.wxMpService.post(MassMessage.MESSAGE_MASS_SEND_URL, message.toJson());
4850
return WxMpMassSendResult.fromJson(responseContent);
4951
}
5052

5153
@Override
5254
public WxMpMassSendResult massMessagePreview(WxMpMassPreviewMessage wxMpMassPreviewMessage) throws WxErrorException {
53-
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_PREVIEW_URL, wxMpMassPreviewMessage.toJson());
55+
String responseContent = this.wxMpService.post(MassMessage.MESSAGE_MASS_PREVIEW_URL, wxMpMassPreviewMessage.toJson());
5456
return WxMpMassSendResult.fromJson(responseContent);
5557
}
5658

@@ -59,7 +61,7 @@ public void delete(Long msgId, Integer articleIndex) throws WxErrorException {
5961
JsonObject jsonObject = new JsonObject();
6062
jsonObject.addProperty("msg_id", msgId);
6163
jsonObject.addProperty("article_idx", articleIndex);
62-
this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_DELETE_URL, jsonObject.toString());
64+
this.wxMpService.post(MassMessage.MESSAGE_MASS_DELETE_URL, jsonObject.toString());
6365
}
6466

6567
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassTagMessage.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.io.Serializable;
88

99
/**
10-
* 按标签群发的消息
10+
* 按标签群发的消息.
1111
*
1212
* @author chanjarster
1313
*/
@@ -16,12 +16,12 @@ public class WxMpMassTagMessage implements Serializable {
1616
private static final long serialVersionUID = -6625914040986749286L;
1717

1818
/**
19-
* 标签id,如果不设置则就意味着发给所有用户
19+
* 标签id,如果不设置则就意味着发给所有用户.
2020
*/
2121
private Long tagId;
2222
/**
2323
* <pre>
24-
* 消息类型
24+
* 消息类型.
2525
* 请使用
2626
* {@link WxConsts.MassMsgType#IMAGE}
2727
* {@link WxConsts.MassMsgType#MPNEWS}
@@ -35,17 +35,17 @@ public class WxMpMassTagMessage implements Serializable {
3535
private String content;
3636
private String mediaId;
3737
/**
38-
* 是否群发给所有用户
38+
* 是否群发给所有用户.
3939
*/
4040
private boolean isSendAll = false;
4141

4242
/**
43-
* 文章被判定为转载时,是否继续进行群发操作
43+
* 文章被判定为转载时,是否继续进行群发操作.
4444
*/
4545
private boolean sendIgnoreReprint = false;
4646

4747
/**
48-
* 开发者侧群发msgid,长度限制64字节,如不填,则后台默认以群发范围和群发内容的摘要值做为clientmsgid
48+
* 开发者侧群发msgid,长度限制64字节,如不填,则后台默认以群发范围和群发内容的摘要值做为clientmsgid.
4949
*/
5050
private String clientMsgId;
5151

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpMassTagMessageGsonAdapter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import java.lang.reflect.Type;
1212

1313
/**
14-
* @author someone
14+
* 群发消息json转换适配器.
15+
*
16+
* @author chanjarster
1517
*/
1618
public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTagMessage> {
1719

0 commit comments

Comments
 (0)