Skip to content

Commit cb78119

Browse files
committed
Merge branch 'develop-chan' into develop
2 parents b47c967 + e57eb3f commit cb78119

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,23 @@ public interface WxMpService {
801801

802802
/**
803803
* 发送微信红包给个人用户
804+
*
805+
* 需要传入的必填参数如下:
806+
* mch_billno//商户订单号
807+
* send_name//商户名称
808+
* re_openid//用户openid
809+
* total_amount//红包总额
810+
* total_num//红包发放总人数
811+
* wishing//红包祝福语
812+
* client_ip//服务器Ip地址
813+
* act_name//活动名称
814+
* remark //备注
815+
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5
816+
*
817+
* 使用现金红包功能需要在xml配置文件中额外设置:
818+
* <partnerId></partnerId>微信商户平台ID
819+
* <partnerKey></partnerKey>商户平台设置的API密钥
820+
*
804821
* @param parameters
805822
* @return
806823
* @throws WxErrorException
@@ -863,13 +880,24 @@ public WxCardApiSignature createCardApiSignature(String... optionalSignParam) th
863880
*/
864881
public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume)
865882
throws WxErrorException;
866-
867-
/**
883+
884+
/**
868885
* 卡券Code核销。核销失败会抛出异常
886+
*
869887
* @param code 单张卡券的唯一标准
888+
* @return 调用返回的JSON字符串。
889+
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
890+
* @throws WxErrorException
891+
*/
892+
public String consumeCardCode(String code) throws WxErrorException;
893+
894+
/**
895+
* 卡券Code核销。核销失败会抛出异常
896+
*
897+
* @param code 单张卡券的唯一标准
870898
* @param cardId 当自定义Code卡券时需要传入card_id
871899
* @return 调用返回的JSON字符串。
872-
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
900+
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
873901
* @throws WxErrorException
874902
*/
875903
public String consumeCardCode(String code, String cardId) throws WxErrorException;

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpServiceImpl.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,22 @@ public WxMpCardResult queryCardCode(String cardId, String code, boolean checkCon
11741174
* 卡券Code核销。核销失败会抛出异常
11751175
*
11761176
* @param code 单张卡券的唯一标准
1177+
* @return 调用返回的JSON字符串。
1178+
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
1179+
* @throws WxErrorException
1180+
*/
1181+
@Override
1182+
public String consumeCardCode(String code) throws WxErrorException {
1183+
return consumeCardCode(code, null);
1184+
}
1185+
1186+
/**
1187+
* 卡券Code核销。核销失败会抛出异常
1188+
*
1189+
* @param code 单张卡券的唯一标准
1190+
* @param cardId 当自定义Code卡券时需要传入card_id
1191+
* @return 调用返回的JSON字符串。
1192+
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
11771193
* @throws WxErrorException
11781194
*/
11791195
@Override
@@ -1183,7 +1199,7 @@ public String consumeCardCode(String code, String cardId) throws WxErrorExceptio
11831199
param.addProperty("code", code);
11841200

11851201
if (cardId != null && !"".equals(cardId)) {
1186-
param.addProperty("card_id", cardId);
1202+
param.addProperty("card_id", cardId);
11871203
}
11881204

11891205
String responseContent = post(url, param.toString());

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMaterialNews.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public static class WxMpMaterialNewsArticle {
4646
* (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得
4747
*/
4848
private String thumbMediaId;
49+
/**
50+
* 图文消息的封面url
51+
*/
52+
private String thumbUrl;
4953
/**
5054
* 图文消息的作者
5155
*/
@@ -141,9 +145,17 @@ public void setUrl(String url) {
141145
this.url = url;
142146
}
143147

148+
public String getThumbUrl() {
149+
return thumbUrl;
150+
}
151+
152+
public void setThumbUrl(String thumbUrl) {
153+
this.thumbUrl = thumbUrl;
154+
}
155+
144156
@Override
145157
public String toString() {
146-
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
158+
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + "thumbUrl=" + thumbUrl + ", author=" + author + ", title=" + title +
147159
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
148160
", showCoverPic=" + showCoverPic +", url=" + url + "]";
149161
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpMaterialNewsArticleGsonAdapter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public JsonElement serialize(WxMpMaterialNews.WxMpMaterialNewsArticle article, T
2020
JsonObject articleJson = new JsonObject();
2121

2222
articleJson.addProperty("thumb_media_id", article.getThumbMediaId());
23+
articleJson.addProperty("thumb_url",article.getThumbUrl());
2324
articleJson.addProperty("title", article.getTitle());
2425
articleJson.addProperty("content", article.getContent());
2526
if (null != article.getAuthor()) {
@@ -66,6 +67,10 @@ public WxMpMaterialNews.WxMpMaterialNewsArticle deserialize(JsonElement jsonElem
6667
if (thumbMediaId != null && !thumbMediaId.isJsonNull()) {
6768
article.setThumbMediaId(GsonHelper.getAsString(thumbMediaId));
6869
}
70+
JsonElement thumbUrl = articleInfo.get("thumb_url");
71+
if(thumbUrl != null && !thumbUrl.isJsonNull()) {
72+
article.setThumbUrl(GsonHelper.getAsString(thumbUrl));
73+
}
6974
JsonElement showCoverPic = articleInfo.get("show_cover_pic");
7075
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
7176
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));

0 commit comments

Comments
 (0)