1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| @RestController
...
@PostMapping("wxa/code") public ResponseEntity<?> getWxaShareCode() { try {
ByteArrayOutputStream byteArrayOutputStream = TucHttpUtil.httpPostInputStream("https://developers.weixin.qq.com/miniprogram/dev/image/qrcode/qrcode.png?t=18082721", null);
InputStream is = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); return ResponseEntity.ok() .header("content-type","image/png") .body(new InputStreamResource(is));
} catch (Exception e) { return ResponseEntity.notFound().build(); } } ...
|