| | |
| | | //图片上传路径 |
| | | public static final String IMG_UPLOAD_PATH="/home/javaweb/webresource/upload/wxcode"; |
| | | public String generateAcode(String scene,String path,String imgName,String width, Integer type){ |
| | | String urlPrefix="http://hcres.csxuncong.com/wxcode"; |
| | | String urlPrefix="https://hcres.csxuncong.com/wxcode"; |
| | | String imgPath=IMG_UPLOAD_PATH+imgName; |
| | | if(!FileUtil.exist(imgPath)){ |
| | | |
| | |
| | | obj.set("is_hyaline", false); |
| | | try { |
| | | HttpResponse execute = HttpRequest.post(url).body(obj.toString(), "application/json").execute(); |
| | | log.error("微信返回值:{}", execute.body()); |
| | | // log.error("微信返回值:{}", execute.body()); |
| | | InputStream inputStream = execute.bodyStream(); |
| | | File file = new File(imgPath); |
| | | FileUtil.writeFromStream(inputStream, file); |
| | |
| | | } |
| | | } |
| | | log.debug("生成微信小程序码成功,路径:" + imgPath); |
| | | return urlPrefix+"/"+imgName; |
| | | return urlPrefix+imgName; |
| | | } |
| | | |
| | | /** |