mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	✨ #1188 增加获取会员卡开卡链接的接口
This commit is contained in:
		| @ -93,6 +93,16 @@ public interface WxMpMemberCardService { | |||||||
|    */ |    */ | ||||||
|   ActivatePluginParam getActivatePluginParam(String cardId, String outStr) throws WxErrorException; |   ActivatePluginParam getActivatePluginParam(String cardId, String outStr) throws WxErrorException; | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 获取开卡组件链接接口 | ||||||
|  |    * | ||||||
|  |    * @param cardId 会员卡的CardId,微信分配 | ||||||
|  |    * @param outStr 会员卡设置商户的渠道 | ||||||
|  |    * @return 会员卡开卡插件参数结果对象 | ||||||
|  |    * @throws WxErrorException 接口调用失败抛出的异常 | ||||||
|  |    */ | ||||||
|  |   String getActivatePluginUrl(String cardId, String outStr) throws WxErrorException; | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 更新会员卡信息. |    * 更新会员卡信息. | ||||||
|    * |    * | ||||||
|  | |||||||
| @ -248,13 +248,7 @@ public class WxMpMemberCardServiceImpl implements WxMpMemberCardService { | |||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public ActivatePluginParam getActivatePluginParam(String cardId, String outStr) throws WxErrorException { |   public ActivatePluginParam getActivatePluginParam(String cardId, String outStr) throws WxErrorException { | ||||||
|     JsonObject params = new JsonObject(); |     String url = this.getActivatePluginUrl(cardId, outStr); | ||||||
|     params.addProperty("card_id", cardId); |  | ||||||
|     params.addProperty("outer_str", outStr); |  | ||||||
|     String response = this.wxMpService.post(WxMpApiUrl.MemberCard.MEMBER_CARD_ACTIVATE_URL, GSON.toJson(params)); |  | ||||||
|     ActivatePluginParamResult result = GSON.fromJson(response, ActivatePluginParamResult.class); |  | ||||||
|     if (0 == result.getErrcode()) { |  | ||||||
|       String url = result.getUrl(); |  | ||||||
|     try { |     try { | ||||||
|       String decodedUrl = URLDecoder.decode(url, "UTF-8"); |       String decodedUrl = URLDecoder.decode(url, "UTF-8"); | ||||||
|       Map<String, String> resultMap = parseRequestUrl(decodedUrl); |       Map<String, String> resultMap = parseRequestUrl(decodedUrl); | ||||||
| @ -266,10 +260,20 @@ public class WxMpMemberCardServiceImpl implements WxMpMemberCardService { | |||||||
|     } catch (UnsupportedEncodingException e) { |     } catch (UnsupportedEncodingException e) { | ||||||
|       e.printStackTrace(); |       e.printStackTrace(); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|     return null; |     return null; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   @Override | ||||||
|  |   public String getActivatePluginUrl(String cardId, String outStr) throws WxErrorException { | ||||||
|  |     JsonObject params = new JsonObject(); | ||||||
|  |     params.addProperty("card_id", cardId); | ||||||
|  |     params.addProperty("outer_str", outStr); | ||||||
|  |     String response = this.wxMpService.post(WxMpApiUrl.MemberCard.MEMBER_CARD_ACTIVATE_URL, GSON.toJson(params)); | ||||||
|  |     ActivatePluginParamResult result = GSON.fromJson(response, ActivatePluginParamResult.class); | ||||||
|  |     return result.getUrl(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public CardUpdateResult updateCardInfo(MemberCardUpdateRequest memberCardUpdateRequest) throws WxErrorException { |   public CardUpdateResult updateCardInfo(MemberCardUpdateRequest memberCardUpdateRequest) throws WxErrorException { | ||||||
|     String response = this.wxMpService.post(WxMpApiUrl.MemberCard.MEMBER_CARD_UPDATE, GSON.toJson(memberCardUpdateRequest)); |     String response = this.wxMpService.post(WxMpApiUrl.MemberCard.MEMBER_CARD_UPDATE, GSON.toJson(memberCardUpdateRequest)); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 S
					S