| | |
| | | throw new ValidationException("微信code为空"); |
| | | } |
| | | |
| | | String accessToken=""; |
| | | try { |
| | | accessToken=maService.getAccessToken(); |
| | | } catch (WxErrorException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | // String accessToken=""; |
| | | // try { |
| | | // accessToken=maService.getAccessToken(); |
| | | // } catch (WxErrorException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // |
| | | // if(StringUtils.isEmpty(accessToken)){ |
| | | // accessToken=getAccessToken( |
| | | // wxMiniappProperties.getCustomer().getAppid(), |
| | | // wxMiniappProperties.getCustomer().getSecret()); |
| | | // if(StringUtils.isEmpty(accessToken)){ |
| | | // throw new ValidationException("获取微信AccessToken失败"); |
| | | // } |
| | | // } |
| | | // 直接使用手动获取token的方式(跳过WxMaService的token) |
| | | String accessToken = getAccessToken( |
| | | wxMiniappProperties.getCustomer().getAppid(), |
| | | wxMiniappProperties.getCustomer().getSecret()); |
| | | |
| | | if(StringUtils.isEmpty(accessToken)){ |
| | | accessToken=getAccessToken( |
| | | wxMiniappProperties.getCustomer().getAppid(), |
| | | wxMiniappProperties.getCustomer().getSecret()); |
| | | if(StringUtils.isEmpty(accessToken)){ |
| | | throw new ValidationException("获取微信AccessToken失败"); |
| | | } |
| | | throw new ValidationException("获取微信AccessToken失败"); |
| | | } |
| | | |
| | | |
| | | String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="+ accessToken; |
| | | try{ |