From cc7a83e350c507f0ecc006aae357d50a20a61725 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Thu, 29 Jun 2017 20:07:35 +0800 Subject: [PATCH] =?UTF-8?q?#260=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=8F=91=E9=80=81=E6=A8=A1=E7=89=88=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=95=B4=E7=90=86javadoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/binarywang/wx/miniapp/api/WxMaMsgService.java | 9 ++++----- .../wx/miniapp/api/impl/WxMaMsgServiceImpl.java | 8 +++----- .../binarywang/wx/miniapp/api/impl/WxMaServiceImpl.java | 6 +++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaMsgService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaMsgService.java index 040e81e5..65522f4b 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaMsgService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaMsgService.java @@ -18,7 +18,7 @@ public interface WxMaMsgService { /** *
    * 发送客服消息
-   * 详情请见: 发送客服消息
+   * 详情请见: 发送客服消息
    * 接口url格式:https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
    * 
*/ @@ -27,10 +27,9 @@ public interface WxMaMsgService { /** *
    * 发送模板消息
-   * 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN
+   * 详情请见: 发送模板消息
+   * 接口url格式:https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
    * 
- * - * @return 消息Id */ - String sendTemplateMsg(WxMaTemplateMessage templateMessage) throws WxErrorException; + void sendTemplateMsg(WxMaTemplateMessage templateMessage) throws WxErrorException; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImpl.java index 238bbe0e..70a4e504 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImpl.java @@ -27,14 +27,12 @@ public class WxMaMsgServiceImpl implements WxMaMsgService { } @Override - public String sendTemplateMsg(WxMaTemplateMessage templateMessage) throws WxErrorException { + public void sendTemplateMsg(WxMaTemplateMessage templateMessage) throws WxErrorException { String responseContent = this.wxMaService.post(TEMPLATE_MSG_SEND_URL, templateMessage.toJson()); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); - if (jsonObject.get("errcode").getAsInt() == 0) { - return jsonObject.get("msgid").getAsString(); + if (jsonObject.get("errcode").getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent)); } - - throw new WxErrorException(WxError.fromJson(responseContent)); } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImpl.java index 16734126..c8605d25 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImpl.java @@ -193,7 +193,7 @@ public class WxMaServiceImpl implements WxMaService, RequestHttp