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 @@ -504,7 +504,10 @@ public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorEx
504
504
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send" ;
505
505
String responseContent = execute (new SimplePostRequestExecutor (), url , templateMessage .toJson ());
506
506
JsonElement tmpJsonElement = Streams .parse (new JsonReader (new StringReader (responseContent )));
507
- return tmpJsonElement .getAsJsonObject ().get ("msgid" ).getAsString ();
507
+ final JsonObject jsonObject = tmpJsonElement .getAsJsonObject ();
508
+ if (jsonObject .get ("errcode" ).getAsInt () == 0 )
509
+ return jsonObject .get ("msgid" ).getAsString ();
510
+ throw new WxErrorException (WxError .fromJson (responseContent ));
508
511
}
509
512
510
513
public WxMpSemanticQueryResult semanticQuery (WxMpSemanticQuery semanticQuery ) throws WxErrorException {
You can’t perform that action at this time.
0 commit comments