|  |  | 
 |  |  | import cn.hutool.core.thread.ThreadUtil;
 | 
 |  |  | import cn.hutool.core.util.StrUtil;
 | 
 |  |  | import cn.hutool.http.HttpRequest;
 | 
 |  |  | import cn.hutool.http.HttpResponse;
 | 
 |  |  | import cn.hutool.http.HttpUtil;
 | 
 |  |  | import cn.hutool.json.JSONUtil;
 | 
 |  |  | import com.alibaba.fastjson.JSONObject;
 | 
 |  |  | 
 |  |  |             //是否需要透明底色,为 true 时,生成透明底色的小程序码
 | 
 |  |  |             obj.put("is_hyaline", false);
 | 
 |  |  |             try {
 | 
 |  |  |                 InputStream inputStream = HttpRequest.post(url).body(obj.toString(), "application/json").execute().bodyStream();
 | 
 |  |  |                 log.info("======>>{}", url);
 | 
 |  |  |                 HttpResponse execute = HttpRequest.post(url).body(obj.toString(), "application/json").execute();
 | 
 |  |  |                 log.info("=======>>>{}", execute.body());
 | 
 |  |  |                 InputStream inputStream = execute.bodyStream();
 | 
 |  |  |                 File file = new File(imgPath);
 | 
 |  |  |                 FileUtil.writeFromStream(inputStream, file);
 | 
 |  |  |                 long uploadUrl = FileUtil.size(file);
 |