mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-01 20:13:12 +08:00
issue #51 发送模板消息需要返回 获得的messageid
This commit is contained in:
@ -315,8 +315,9 @@ public interface WxMpService {
|
|||||||
* </pre>
|
* </pre>
|
||||||
* @param templateMessage
|
* @param templateMessage
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
|
* @return msgid
|
||||||
*/
|
*/
|
||||||
public void templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
|||||||
@ -286,9 +286,11 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
return tmpJsonElement.getAsJsonObject().get("short_url").getAsString();
|
return tmpJsonElement.getAsJsonObject().get("short_url").getAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException {
|
public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send";
|
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send";
|
||||||
execute(new SimplePostRequestExecutor(), url, templateMessage.toJson());
|
String responseContent = execute(new SimplePostRequestExecutor(), url, templateMessage.toJson());
|
||||||
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
|
return tmpJsonElement.getAsJsonObject().get("msgid").getAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException {
|
public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException {
|
||||||
|
|||||||
Reference in New Issue
Block a user