cloudroam
4 天以前 46715d892da947c31f07796fdc79dbbef06677b3
src/main/java/com/mzl/flower/service/system/WeChatService.java
@@ -166,22 +166,29 @@
            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{