File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -507,7 +507,10 @@ public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorEx
507
507
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send" ;
508
508
String responseContent = execute (new SimplePostRequestExecutor (), url , templateMessage .toJson ());
509
509
JsonElement tmpJsonElement = Streams .parse (new JsonReader (new StringReader (responseContent )));
510
- return tmpJsonElement .getAsJsonObject ().get ("msgid" ).getAsString ();
510
+ final JsonObject jsonObject = tmpJsonElement .getAsJsonObject ();
511
+ if (jsonObject .get ("errcode" ).getAsInt () == 0 )
512
+ return jsonObject .get ("msgid" ).getAsString ();
513
+ throw new WxErrorException (WxError .fromJson (responseContent ));
511
514
}
512
515
513
516
public WxMpSemanticQueryResult semanticQuery (WxMpSemanticQuery semanticQuery ) throws WxErrorException {
You can’t perform that action at this time.
0 commit comments