msgid
This commit is contained in:
parent
9d21efe31f
commit
2adaf6d569
@ -1558,7 +1558,7 @@ public class WeixinProxy {
|
|||||||
*
|
*
|
||||||
* @param tplMessage
|
* @param tplMessage
|
||||||
* 模板消息主体
|
* 模板消息主体
|
||||||
* @return 发送结果
|
* @return 发送的消息ID
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
|
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
|
||||||
@ -1570,7 +1570,7 @@ public class WeixinProxy {
|
|||||||
* @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
|
* @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
|
||||||
* @see com.foxinmy.weixin4j.mp.api.TmplApi
|
* @see com.foxinmy.weixin4j.mp.api.TmplApi
|
||||||
*/
|
*/
|
||||||
public ApiResult sendTmplMessage(TemplateMessage tplMessage)
|
public String sendTmplMessage(TemplateMessage tplMessage)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return tmplApi.sendTmplMessage(tplMessage);
|
return tmplApi.sendTmplMessage(tplMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,7 +147,7 @@ public class TmplApi extends MpApi {
|
|||||||
*
|
*
|
||||||
* @param tplMessage
|
* @param tplMessage
|
||||||
* 消息对象
|
* 消息对象
|
||||||
* @return 发送结果
|
* @return 发送的消息ID
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">模板消息</a>
|
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">模板消息</a>
|
||||||
@ -157,7 +157,7 @@ public class TmplApi extends MpApi {
|
|||||||
* @see com.foxinmy.weixin4j.mp.message.TemplateMessage
|
* @see com.foxinmy.weixin4j.mp.message.TemplateMessage
|
||||||
* @see com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
|
* @see com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
|
||||||
*/
|
*/
|
||||||
public ApiResult sendTmplMessage(TemplateMessage tplMessage)
|
public String sendTmplMessage(TemplateMessage tplMessage)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
Token token = tokenManager.getCache();
|
Token token = tokenManager.getCache();
|
||||||
String template_send_uri = getRequestUri("template_send_uri");
|
String template_send_uri = getRequestUri("template_send_uri");
|
||||||
@ -174,6 +174,6 @@ public class TmplApi extends MpApi {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return response.getAsResult();
|
return response.getAsJson().getString("msgid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
package com.foxinmy.weixin4j.mp.test;
|
package com.foxinmy.weixin4j.mp.test;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
import com.foxinmy.weixin4j.http.weixin.ApiResult;
|
|
||||||
import com.foxinmy.weixin4j.mp.api.TmplApi;
|
import com.foxinmy.weixin4j.mp.api.TmplApi;
|
||||||
import com.foxinmy.weixin4j.mp.message.TemplateMessage;
|
import com.foxinmy.weixin4j.mp.message.TemplateMessage;
|
||||||
import com.foxinmy.weixin4j.mp.type.IndustryType;
|
import com.foxinmy.weixin4j.mp.type.IndustryType;
|
||||||
@ -39,7 +37,7 @@ public class TemplateTest extends TokenTest {
|
|||||||
TemplateMessage tplMessage = new TemplateMessage("touser",
|
TemplateMessage tplMessage = new TemplateMessage("touser",
|
||||||
"template_id", "url");
|
"template_id", "url");
|
||||||
tplMessage.pushHead("head").pushTail("tail").pushItem("key1", "text1");
|
tplMessage.pushHead("head").pushTail("tail").pushItem("key1", "text1");
|
||||||
ApiResult result = tmplApi.sendTmplMessage(tplMessage);
|
String result = tmplApi.sendTmplMessage(tplMessage);
|
||||||
Assert.assertEquals("0", result.getReturnCode());
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user