File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -315,8 +315,9 @@ public interface WxMpService {
315315 * </pre>
316316 * @param templateMessage
317317 * @throws WxErrorException
318+ * @return msgid
318319 */
319- public void templateSend (WxMpTemplateMessage templateMessage ) throws WxErrorException ;
320+ public String templateSend (WxMpTemplateMessage templateMessage ) throws WxErrorException ;
320321
321322 /**
322323 * <pre>
Original file line number Diff line number Diff line change @@ -286,9 +286,11 @@ public String shortUrl(String long_url) throws WxErrorException {
286286 return tmpJsonElement .getAsJsonObject ().get ("short_url" ).getAsString ();
287287 }
288288
289- public void templateSend (WxMpTemplateMessage templateMessage ) throws WxErrorException {
289+ public String templateSend (WxMpTemplateMessage templateMessage ) throws WxErrorException {
290290 String url = "https://api.weixin.qq.com/cgi-bin/message/template/send" ;
291- execute (new SimplePostRequestExecutor (), url , templateMessage .toJson ());
291+ String responseContent = execute (new SimplePostRequestExecutor (), url , templateMessage .toJson ());
292+ JsonElement tmpJsonElement = Streams .parse (new JsonReader (new StringReader (responseContent )));
293+ return tmpJsonElement .getAsJsonObject ().get ("msgid" ).getAsString ();
292294 }
293295
294296 public WxMpSemanticQueryResult semanticQuery (WxMpSemanticQuery semanticQuery ) throws WxErrorException {
You can’t perform that action at this time.
0 commit comments