mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 22:11:40 +08:00
Merge branch 'develop-chan' into develop
This commit is contained in:
commit
cb78119cdd
@ -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
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
@ -864,12 +881,23 @@ public interface WxMpService {
|
||||
public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume)
|
||||
throws WxErrorException;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 卡券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
|
||||
* @return 调用返回的JSON字符串。
|
||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
|
||||
* <br>可用 com.google.gson.JsonParser#parse 等方法直接取JSON串中的errcode等信息。
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
public String consumeCardCode(String code, String cardId) throws WxErrorException;
|
||||
|
@ -1174,6 +1174,22 @@ public class WxMpServiceImpl implements WxMpService {
|
||||
* 卡券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
|
||||
*/
|
||||
@Override
|
||||
@ -1183,7 +1199,7 @@ public class WxMpServiceImpl implements WxMpService {
|
||||
param.addProperty("code", code);
|
||||
|
||||
if (cardId != null && !"".equals(cardId)) {
|
||||
param.addProperty("card_id", cardId);
|
||||
param.addProperty("card_id", cardId);
|
||||
}
|
||||
|
||||
String responseContent = post(url, param.toString());
|
||||
|
@ -46,6 +46,10 @@ public class WxMpMaterialNews implements Serializable {
|
||||
* (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得
|
||||
*/
|
||||
private String thumbMediaId;
|
||||
/**
|
||||
* 图文消息的封面url
|
||||
*/
|
||||
private String thumbUrl;
|
||||
/**
|
||||
* 图文消息的作者
|
||||
*/
|
||||
@ -141,9 +145,17 @@ public class WxMpMaterialNews implements Serializable {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getThumbUrl() {
|
||||
return thumbUrl;
|
||||
}
|
||||
|
||||
public void setThumbUrl(String thumbUrl) {
|
||||
this.thumbUrl = thumbUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
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 +
|
||||
", showCoverPic=" + showCoverPic +", url=" + url + "]";
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
|
||||
JsonObject articleJson = new JsonObject();
|
||||
|
||||
articleJson.addProperty("thumb_media_id", article.getThumbMediaId());
|
||||
articleJson.addProperty("thumb_url",article.getThumbUrl());
|
||||
articleJson.addProperty("title", article.getTitle());
|
||||
articleJson.addProperty("content", article.getContent());
|
||||
if (null != article.getAuthor()) {
|
||||
@ -66,6 +67,10 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
|
||||
if (thumbMediaId != null && !thumbMediaId.isJsonNull()) {
|
||||
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");
|
||||
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
||||
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));
|
||||
|
Loading…
Reference in New Issue
Block a user