mirror of
https://gitee.com/jfinal/jfinal-weixin.git
synced 2024-12-01 19:37:52 +08:00
feature:发送小程序订阅消息支持 miniprogramState 参数
This commit is contained in:
parent
e6717c7dbd
commit
9d2177caa0
@ -115,9 +115,10 @@ public class WxaSubscribeMsgApi {
|
||||
* @param templateId 所需下发的订阅模板id
|
||||
* @param data
|
||||
* @param page 示例index?foo=bar
|
||||
* @param miniprogramState 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
|
||||
* @return {ApiResult}
|
||||
*/
|
||||
public static ApiResult send(String toUser, String templateId, SubTemplateItem data, String page) {
|
||||
public static ApiResult send(String toUser, String templateId, SubTemplateItem data, String page, String miniprogramState) {
|
||||
String accessToken = WxaAccessTokenApi.getAccessTokenStr();
|
||||
Kv kv = Kv.by("touser", toUser)
|
||||
.set("template_id", templateId)
|
||||
@ -125,10 +126,26 @@ public class WxaSubscribeMsgApi {
|
||||
if (StrKit.notBlank(page)) {
|
||||
kv.set("page", page);
|
||||
}
|
||||
if (StrKit.notBlank(miniprogramState)) {
|
||||
kv.set("miniprogram_state", miniprogramState);
|
||||
}
|
||||
String jsonResult = HttpUtils.post(sendUrl + accessToken, JsonUtils.toJson(kv));
|
||||
return new ApiResult(jsonResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送订阅消息
|
||||
*
|
||||
* @param toUser 接收者(用户)的 openid
|
||||
* @param templateId 所需下发的订阅模板id
|
||||
* @param data
|
||||
* @param page 示例index?foo=bar
|
||||
* @return {ApiResult}
|
||||
*/
|
||||
public static ApiResult send(String toUser, String templateId, SubTemplateItem data, String page) {
|
||||
return send(toUser, templateId, data, page, null);
|
||||
}
|
||||
|
||||
public static class SubTemplateItem extends HashMap<String, Item> {
|
||||
private static final long serialVersionUID = -3728490424738325020L;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user