mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
优化代码
This commit is contained in:
@@ -11,6 +11,8 @@ import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
||||
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
|
||||
|
||||
import static me.chanjar.weixin.mp.enums.WxMpApiUrl.*;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 群发消息服务类
|
||||
@@ -26,31 +28,31 @@ public class WxMpMassMessageServiceImpl implements WxMpMassMessageService {
|
||||
|
||||
@Override
|
||||
public WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException {
|
||||
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MEDIA_UPLOAD_NEWS_URL, news.toJson());
|
||||
String responseContent = this.wxMpService.post(MassMessage.MEDIA_UPLOAD_NEWS_URL, news.toJson());
|
||||
return WxMpMassUploadResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException {
|
||||
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MEDIA_UPLOAD_VIDEO_URL, video.toJson());
|
||||
String responseContent = this.wxMpService.post(MassMessage.MEDIA_UPLOAD_VIDEO_URL, video.toJson());
|
||||
return WxMpMassUploadResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException {
|
||||
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_SENDALL_URL, message.toJson());
|
||||
String responseContent = this.wxMpService.post(MassMessage.MESSAGE_MASS_SENDALL_URL, message.toJson());
|
||||
return WxMpMassSendResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpMassSendResult massOpenIdsMessageSend(WxMpMassOpenIdsMessage message) throws WxErrorException {
|
||||
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_SEND_URL, message.toJson());
|
||||
String responseContent = this.wxMpService.post(MassMessage.MESSAGE_MASS_SEND_URL, message.toJson());
|
||||
return WxMpMassSendResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMpMassSendResult massMessagePreview(WxMpMassPreviewMessage wxMpMassPreviewMessage) throws WxErrorException {
|
||||
String responseContent = this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_PREVIEW_URL, wxMpMassPreviewMessage.toJson());
|
||||
String responseContent = this.wxMpService.post(MassMessage.MESSAGE_MASS_PREVIEW_URL, wxMpMassPreviewMessage.toJson());
|
||||
return WxMpMassSendResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@@ -59,7 +61,7 @@ public class WxMpMassMessageServiceImpl implements WxMpMassMessageService {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("msg_id", msgId);
|
||||
jsonObject.addProperty("article_idx", articleIndex);
|
||||
this.wxMpService.post(WxMpApiUrl.MassMessage.MESSAGE_MASS_DELETE_URL, jsonObject.toString());
|
||||
this.wxMpService.post(MassMessage.MESSAGE_MASS_DELETE_URL, jsonObject.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user