From bf49c9a15211dd48b7e00da2676187ff812bee4e Mon Sep 17 00:00:00 2001 From: JTongChen <819250131@qq.com> Date: Sat, 7 Oct 2023 21:32:21 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#3142=20=E3=80=90=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E3=80=91=E8=AE=A2=E9=98=85=E9=80=9A=E7=9F=A5=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=B6=88=E6=81=AF?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/chanjar/weixin/mp/api/WxMpSubscribeMsgService.java | 3 ++- .../weixin/mp/api/impl/WxMpSubscribeMsgServiceImpl.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpSubscribeMsgService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpSubscribeMsgService.java index fac1788ea..fa5a5dbbf 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpSubscribeMsgService.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpSubscribeMsgService.java @@ -134,8 +134,9 @@ public interface WxMpSubscribeMsgService { * * * @param subscribeMessage 订阅消息 + * @return 下发消息id,与下发结果回调的msgId对应 * @throws WxErrorException . */ - void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException; + String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException; } diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpSubscribeMsgServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpSubscribeMsgServiceImpl.java index 07c580094..2d83259e8 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpSubscribeMsgServiceImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpSubscribeMsgServiceImpl.java @@ -103,11 +103,12 @@ public class WxMpSubscribeMsgServiceImpl implements WxMpSubscribeMsgService { } @Override - public void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException { + public String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException { String responseContent = this.service.post(SEND_SUBSCRIBE_MESSAGE_URL, subscribeMessage.toJson()); JsonObject jsonObject = GsonParser.parse(responseContent); if (jsonObject.get(ERR_CODE).getAsInt() != 0) { throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP)); } + return jsonObject.get("msgid").getAsString(); } }