mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-30 10:07:06 +08:00
issue #51 发送模板消息需要返回 获得的messageid
This commit is contained in:
@ -315,8 +315,9 @@ public interface WxMpService {
|
||||
* </pre>
|
||||
* @param templateMessage
|
||||
* @throws WxErrorException
|
||||
* @return msgid
|
||||
*/
|
||||
public void templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
||||
public String templateSend(WxMpTemplateMessage templateMessage) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
||||
@ -286,9 +286,11 @@ public class WxMpServiceImpl implements WxMpService {
|
||||
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";
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user