mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #1328 微信卡劵增加用户已领取卡券列表接口
* 微信公众号,功能新增,微信卡券 添加用户已领取卡券接口 * 添加用户已领取卡券接口测试代码
This commit is contained in:
@@ -283,4 +283,15 @@ public interface WxMpCardService {
|
||||
void cardSelfConsumeCellSet(String cardId, Boolean isOpen,
|
||||
Boolean needVerifyCod, Boolean needRemarkAmount) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取用户已领取卡券接口
|
||||
* https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Managing_Coupons_Vouchers_and_Cards.html#1
|
||||
*
|
||||
* @param openId 需要查询的用户openid
|
||||
* @param cardId 卡券ID。不填写时默认查询当前appid下的卡券
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxUserCardListResult getUserCardList(String openId, String cardId) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
||||
@@ -351,6 +351,16 @@ public class WxMpCardServiceImpl implements WxMpCardService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxUserCardListResult getUserCardList(String openId, String cardId) throws WxErrorException {
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("openid", openId);
|
||||
param.addProperty("card_id", cardId);
|
||||
String response = this.wxMpService.post(WxMpApiUrl.Card.CARD_USER_CARD_LIST, param.toString());
|
||||
return WxUserCardListResult.fromJson(response);
|
||||
}
|
||||
|
||||
|
||||
private void checkCardId(String cardId) throws WxErrorException {
|
||||
if (StringUtils.isEmpty(cardId)) {
|
||||
throw new WxErrorException(WxError.builder().errorCode(41012).errorMsg("cardId不能为空").build());
|
||||
|
||||
Reference in New Issue
Block a user