@@ -801,6 +801,23 @@ public interface WxMpService { | |||||
/** | /** | ||||
* 发送微信红包给个人用户 | * 发送微信红包给个人用户 | ||||
* | |||||
* 需要传入的必填参数如下: | |||||
* mch_billno//商户订单号 | |||||
* send_name//商户名称 | |||||
* re_openid//用户openid | |||||
* total_amount//红包总额 | |||||
* total_num//红包发放总人数 | |||||
* wishing//红包祝福语 | |||||
* client_ip//服务器Ip地址 | |||||
* act_name//活动名称 | |||||
* remark //备注 | |||||
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5 | |||||
* | |||||
* 使用现金红包功能需要在xml配置文件中额外设置: | |||||
* <partnerId></partnerId>微信商户平台ID | |||||
* <partnerKey></partnerKey>商户平台设置的API密钥 | |||||
* | |||||
* @param parameters | * @param parameters | ||||
* @return | * @return | ||||
* @throws WxErrorException | * @throws WxErrorException | ||||
@@ -863,13 +880,24 @@ public interface WxMpService { | |||||
*/ | */ | ||||
public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) | public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) | ||||
throws WxErrorException; | throws WxErrorException; | ||||
/** | |||||
/** | |||||
* 卡券Code核销。核销失败会抛出异常 | * 卡券Code核销。核销失败会抛出异常 | ||||
* | |||||
* @param code 单张卡券的唯一标准 | * @param code 单张卡券的唯一标准 | ||||
* @return 调用返回的JSON字符串。 | |||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
* @throws WxErrorException | |||||
*/ | |||||
public String consumeCardCode(String code) throws WxErrorException; | |||||
/** | |||||
* 卡券Code核销。核销失败会抛出异常 | |||||
* | |||||
* @param code 单张卡券的唯一标准 | |||||
* @param cardId 当自定义Code卡券时需要传入card_id | * @param cardId 当自定义Code卡券时需要传入card_id | ||||
* @return 调用返回的JSON字符串。 | * @return 调用返回的JSON字符串。 | ||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
* @throws WxErrorException | * @throws WxErrorException | ||||
*/ | */ | ||||
public String consumeCardCode(String code, String cardId) throws WxErrorException; | public String consumeCardCode(String code, String cardId) throws WxErrorException; | ||||
@@ -1174,6 +1174,22 @@ public class WxMpServiceImpl implements WxMpService { | |||||
* 卡券Code核销。核销失败会抛出异常 | * 卡券Code核销。核销失败会抛出异常 | ||||
* | * | ||||
* @param code 单张卡券的唯一标准 | * @param code 单张卡券的唯一标准 | ||||
* @return 调用返回的JSON字符串。 | |||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
* @throws WxErrorException | |||||
*/ | |||||
@Override | |||||
public String consumeCardCode(String code) throws WxErrorException { | |||||
return consumeCardCode(code, null); | |||||
} | |||||
/** | |||||
* 卡券Code核销。核销失败会抛出异常 | |||||
* | |||||
* @param code 单张卡券的唯一标准 | |||||
* @param cardId 当自定义Code卡券时需要传入card_id | |||||
* @return 调用返回的JSON字符串。 | |||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。 | |||||
* @throws WxErrorException | * @throws WxErrorException | ||||
*/ | */ | ||||
@Override | @Override | ||||
@@ -1183,7 +1199,7 @@ public class WxMpServiceImpl implements WxMpService { | |||||
param.addProperty("code", code); | param.addProperty("code", code); | ||||
if (cardId != null && !"".equals(cardId)) { | if (cardId != null && !"".equals(cardId)) { | ||||
param.addProperty("card_id", cardId); | |||||
param.addProperty("card_id", cardId); | |||||
} | } | ||||
String responseContent = post(url, param.toString()); | String responseContent = post(url, param.toString()); | ||||
@@ -46,6 +46,10 @@ public class WxMpMaterialNews implements Serializable { | |||||
* (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得 | * (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得 | ||||
*/ | */ | ||||
private String thumbMediaId; | private String thumbMediaId; | ||||
/** | |||||
* 图文消息的封面url | |||||
*/ | |||||
private String thumbUrl; | |||||
/** | /** | ||||
* 图文消息的作者 | * 图文消息的作者 | ||||
*/ | */ | ||||
@@ -141,9 +145,17 @@ public class WxMpMaterialNews implements Serializable { | |||||
this.url = url; | this.url = url; | ||||
} | } | ||||
public String getThumbUrl() { | |||||
return thumbUrl; | |||||
} | |||||
public void setThumbUrl(String thumbUrl) { | |||||
this.thumbUrl = thumbUrl; | |||||
} | |||||
@Override | @Override | ||||
public String toString() { | public String toString() { | ||||
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title + | |||||
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + "thumbUrl=" + thumbUrl + ", author=" + author + ", title=" + title + | |||||
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest + | ", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest + | ||||
", showCoverPic=" + showCoverPic +", url=" + url + "]"; | ", showCoverPic=" + showCoverPic +", url=" + url + "]"; | ||||
} | } | ||||
@@ -20,6 +20,7 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa | |||||
JsonObject articleJson = new JsonObject(); | JsonObject articleJson = new JsonObject(); | ||||
articleJson.addProperty("thumb_media_id", article.getThumbMediaId()); | articleJson.addProperty("thumb_media_id", article.getThumbMediaId()); | ||||
articleJson.addProperty("thumb_url",article.getThumbUrl()); | |||||
articleJson.addProperty("title", article.getTitle()); | articleJson.addProperty("title", article.getTitle()); | ||||
articleJson.addProperty("content", article.getContent()); | articleJson.addProperty("content", article.getContent()); | ||||
if (null != article.getAuthor()) { | if (null != article.getAuthor()) { | ||||
@@ -66,6 +67,10 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa | |||||
if (thumbMediaId != null && !thumbMediaId.isJsonNull()) { | if (thumbMediaId != null && !thumbMediaId.isJsonNull()) { | ||||
article.setThumbMediaId(GsonHelper.getAsString(thumbMediaId)); | article.setThumbMediaId(GsonHelper.getAsString(thumbMediaId)); | ||||
} | } | ||||
JsonElement thumbUrl = articleInfo.get("thumb_url"); | |||||
if(thumbUrl != null && !thumbUrl.isJsonNull()) { | |||||
article.setThumbUrl(GsonHelper.getAsString(thumbUrl)); | |||||
} | |||||
JsonElement showCoverPic = articleInfo.get("show_cover_pic"); | JsonElement showCoverPic = articleInfo.get("show_cover_pic"); | ||||
if (showCoverPic != null && !showCoverPic.isJsonNull()) { | if (showCoverPic != null && !showCoverPic.isJsonNull()) { | ||||
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic)); | article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic)); | ||||