|
1 | 1 | package me.chanjar.weixin.mp.api.impl; |
2 | 2 |
|
3 | | -import java.util.Arrays; |
4 | | -import java.util.concurrent.locks.Lock; |
5 | | - |
6 | | -import org.apache.commons.lang3.StringUtils; |
7 | | -import org.slf4j.Logger; |
8 | | -import org.slf4j.LoggerFactory; |
9 | | - |
10 | | -import com.google.gson.Gson; |
11 | | -import com.google.gson.JsonArray; |
12 | | -import com.google.gson.JsonElement; |
13 | | -import com.google.gson.JsonObject; |
14 | | -import com.google.gson.JsonParser; |
15 | | -import com.google.gson.JsonPrimitive; |
| 3 | +import com.google.gson.*; |
16 | 4 | import com.google.gson.reflect.TypeToken; |
17 | 5 | import me.chanjar.weixin.common.bean.WxCardApiSignature; |
18 | 6 | import me.chanjar.weixin.common.error.WxError; |
|
22 | 10 | import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor; |
23 | 11 | import me.chanjar.weixin.mp.api.WxMpCardService; |
24 | 12 | import me.chanjar.weixin.mp.api.WxMpService; |
25 | | -import me.chanjar.weixin.mp.bean.card.WxMpCardCreateMessage; |
26 | | -import me.chanjar.weixin.mp.bean.card.WxMpCardCreateResult; |
27 | | -import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateRequest; |
28 | | -import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateResult; |
29 | | -import me.chanjar.weixin.mp.bean.card.WxMpCardQrcodeCreateResult; |
30 | | -import me.chanjar.weixin.mp.bean.card.WxMpCardResult; |
| 13 | +import me.chanjar.weixin.mp.bean.card.*; |
31 | 14 | import me.chanjar.weixin.mp.enums.TicketType; |
32 | 15 | import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; |
| 16 | +import org.apache.commons.lang3.StringUtils; |
| 17 | +import org.slf4j.Logger; |
| 18 | +import org.slf4j.LoggerFactory; |
| 19 | + |
| 20 | +import java.util.Arrays; |
| 21 | +import java.util.concurrent.locks.Lock; |
33 | 22 |
|
34 | 23 | /** |
35 | 24 | * Created by Binary Wang on 2016/7/27. |
@@ -325,4 +314,15 @@ public String unavailableCardCode(String cardId, String code, String reason) thr |
325 | 314 | jsonRequest.addProperty("reason", reason); |
326 | 315 | return this.wxMpService.post(CARD_CODE_UNAVAILABLE, GSON.toJson(jsonRequest)); |
327 | 316 | } |
| 317 | + |
| 318 | + @Override |
| 319 | + public WxMpCardDeleteResult deleteCard(String cardId) throws WxErrorException { |
| 320 | + if (StringUtils.isEmpty(cardId)) { |
| 321 | + throw new WxErrorException(WxError.builder().errorCode(41012).errorMsg("cardId不能为空").build()); |
| 322 | + } |
| 323 | + JsonObject param = new JsonObject(); |
| 324 | + param.addProperty("card_id", cardId); |
| 325 | + String response = this.wxMpService.post(CARD_DELETE, param.toString()); |
| 326 | + return WxMpCardDeleteResult.fromJson(response); |
| 327 | + } |
328 | 328 | } |
0 commit comments