微信小程序二维码
返回PNG格式的二维码
"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + getAccessToken();
String scene = "" + sysUserId;
Map<String, Object> body = new HashMap<>();
body.put("scene", scene);
body.put("width", width);
body.put("env_version", StringUtils.isBlank(envVersion) ? "release" : envVersion);
// 直接获取字节数组,而不是尝试解析为JSON
Mono<byte[]> qrCodeMono = WebClient.create()
.post().uri(uri).body(BodyInserters.fromValue(body)).retrieve().bodyToMono(byte[].class);
byte[] qrCodeBytes = qrCodeMono.block();