https://developers.weixin.qq.com/doc/offiaccount/Cards_and_Offer/Card_coupons_error_code.html
同一个激活接口会出现不同的返回结果,有时会出现40056错误!
我的业务代码如下:
/**
* 激活会员卡
* @param appId
* @param mobile
* @param encryptCode
* @throws WxErrorException
*/
@Override
public void activateMemberCard(String appId, String mobile, String encryptCode) throws WxErrorException {
// 激活会员卡
WxMembercardConfig memberCardConfigInfo = wxMembercardConfigService.queryByAppId(appId);
String code = wxMpService.decryptCardCode(appId,encryptCode);
WxMpMemberCardActivatedMessage memberCardActivate = new WxMpMemberCardActivatedMessage();
memberCardActivate.setMembershipNumber(mobile);
memberCardActivate.setCode(code);
memberCardActivate.setCardId(memberCardConfigInfo.getCardId());
String res = wxMpService.activateMemberCard(appId,memberCardActivate);
logger.info("激活会员卡结果:" + res);
}
正常的激活日志监控如下:
2021-12-17 07:41:27.229 [http-nio-9301-exec-1] INFO c.d.w.service.WxSdk.impl.SdkComponentServiceImpl -
【请求地址】: https://api.weixin.qq.com/card/code/decrypt?access_token=52_6oHXmvc_njBFUXilxntjWoOrkmrBhZZBMvX_KWXq4PxtRomK58LnXQv8IAARSYubTpG5GwN9Gnh_YJuTRxs7vccHcL35X4C5eO6iJes4HQr-Wrm-gkUQlJ7LqLbLBs731RzkA27iuwvgdPkjOIWjAKDJDR
【请求方式】:POST
【请求参数】:{"encrypt_code":"FhvR5RKu4iAv7B2gkm2i25bK0W7V331vIef6QujCYH4="}
【响应数据】:{"errcode":0,"errmsg":"ok","code":"583445938495"}
2021-12-17 07:41:27.869 [http-nio-9301-exec-1] INFO c.d.w.service.WxSdk.impl.SdkComponentServiceImpl -
【请求地址】: https://api.weixin.qq.com/card/membercard/activate?access_token=52_6oHXmvc_njBFUXilxntjWoOrkmrBhZZBMvX_KWXq4PxtRomK58LnXQv8IAARSYubTpG5GwN9Gnh_YJuTRxs7vccHcL35X4C5eO6iJes4HQr-Wrm-gkUQlJ7LqLbLBs731RzkA27iuwvgdPkjOIWjAKDJDR
【请求方式】:POST
【请求参数】:{"membership_number":"17374859770","code":"583445938495","card_id":"pumkn1J1LALCp6yOkdXQAPsXGGVE"}
【响应数据】:{"errcode":0,"errmsg":"ok"}
2021-12-17 07:41:27.869 [http-nio-9301-exec-1] INFO c.dnnyun.wechat.service.impl.MemberInfoServiceImpl - 激活会员卡结果:{"errcode":0,"errmsg":"ok"}
激活失败日志监控如下:
2021-12-17 10:12:24.407 [http-nio-9301-exec-10] INFO c.d.w.service.WxSdk.impl.SdkComponentServiceImpl -
【请求地址】: https://api.weixin.qq.com/card/code/decrypt?access_token=52_o2mvOAvMwDjsulTq7PMUh2CZESw-AXA1nBOx51ZMlDHg5tX34Nz39lRYHHmzX7KF1oHkrNEGT2Ab43ll689N9YYCLGyAbPx-PDDBfzVz_SzGCiNFNWUN9cSRelycIl4dM_VTQLJ_zGrPIlRJOJLfADDDYA
【请求方式】:POST
【请求参数】:{"encrypt_code":"OaPJz/tjhNdOZpxi3OBH0kCVmMNehkvyiZuDgh96U6I="}
【响应数据】:{"errcode":0,"errmsg":"ok","code":"961662821915"}
2021-12-17 10:12:24.626 [http-nio-9301-exec-10] INFO c.d.w.service.WxSdk.impl.SdkComponentServiceImpl -
【请求地址】: https://api.weixin.qq.com/card/membercard/activate?access_token=52_o2mvOAvMwDjsulTq7PMUh2CZESw-AXA1nBOx51ZMlDHg5tX34Nz39lRYHHmzX7KF1oHkrNEGT2Ab43ll689N9YYCLGyAbPx-PDDBfzVz_SzGCiNFNWUN9cSRelycIl4dM_VTQLJ_zGrPIlRJOJLfADDDYA
【请求方式】:POST
【请求参数】:{"membership_number":"15826045442","code":"961662821915","card_id":"pV_zI5-gbWL07Sa4-UcK6GbLcNJ4"}
【响应数据】:{"errcode":40056,"errmsg":"invalid serial code hint: [ZiU5Oa0144r981]"}