@Test public void testMarkCardCode() throws Exception { this.wxService.getCardService().markCardCode(this.code, this.cardId, this.openid, true); System.out.println("done"); }
@Override public void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("code", code); param.addProperty("card_id", cardId); param.addProperty("openid", openId); param.addProperty("is_mark", isMark); String responseContent = this.getWxMpService().post(CARD_CODE_MARK, param.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, new TypeToken<WxMpCardResult>() { }.getType()); if (!"0".equals(cardResult.getErrorCode())) { this.log.warn("朋友的券mark失败：{}", cardResult.getErrorMsg()); } }
WxMpCardServiceImpl implements WxMpCardService { @Override public void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("code", code); param.addProperty("card_id", cardId); param.addProperty("openid", openId); param.addProperty("is_mark", isMark); String responseContent = this.getWxMpService().post(CARD_CODE_MARK, param.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, new TypeToken<WxMpCardResult>() { }.getType()); if (!"0".equals(cardResult.getErrorCode())) { this.log.warn("朋友的券mark失败：{}", cardResult.getErrorMsg()); } } }
WxMpCardServiceImpl implements WxMpCardService { @Override public void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("code", code); param.addProperty("card_id", cardId); param.addProperty("openid", openId); param.addProperty("is_mark", isMark); String responseContent = this.getWxMpService().post(CARD_CODE_MARK, param.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, new TypeToken<WxMpCardResult>() { }.getType()); if (!"0".equals(cardResult.getErrorCode())) { this.log.warn("朋友的券mark失败：{}", cardResult.getErrorMsg()); } } WxMpCardServiceImpl(WxMpService wxMpService); }
WxMpCardServiceImpl implements WxMpCardService { @Override public void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("code", code); param.addProperty("card_id", cardId); param.addProperty("openid", openId); param.addProperty("is_mark", isMark); String responseContent = this.getWxMpService().post(CARD_CODE_MARK, param.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, new TypeToken<WxMpCardResult>() { }.getType()); if (!"0".equals(cardResult.getErrorCode())) { this.log.warn("朋友的券mark失败：{}", cardResult.getErrorMsg()); } } WxMpCardServiceImpl(WxMpService wxMpService); @Override WxMpService getWxMpService(); @Override String getCardApiTicket(); @Override String getCardApiTicket(boolean forceRefresh); @Override WxCardApiSignature createCardApiSignature(String... optionalSignParam); @Override String decryptCardCode(String encryptCode); @Override WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume); @Override String consumeCardCode(String code); @Override String consumeCardCode(String code, String cardId); @Override void markCardCode(String code, String cardId, String openId, boolean isMark); @Override String getCardDetail(String cardId); }
WxMpCardServiceImpl implements WxMpCardService { @Override public void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("code", code); param.addProperty("card_id", cardId); param.addProperty("openid", openId); param.addProperty("is_mark", isMark); String responseContent = this.getWxMpService().post(CARD_CODE_MARK, param.toString()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, new TypeToken<WxMpCardResult>() { }.getType()); if (!"0".equals(cardResult.getErrorCode())) { this.log.warn("朋友的券mark失败：{}", cardResult.getErrorMsg()); } } WxMpCardServiceImpl(WxMpService wxMpService); @Override WxMpService getWxMpService(); @Override String getCardApiTicket(); @Override String getCardApiTicket(boolean forceRefresh); @Override WxCardApiSignature createCardApiSignature(String... optionalSignParam); @Override String decryptCardCode(String encryptCode); @Override WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume); @Override String consumeCardCode(String code); @Override String consumeCardCode(String code, String cardId); @Override void markCardCode(String code, String cardId, String openId, boolean isMark); @Override String getCardDetail(String cardId);  }