<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>3.5.0</version>
</dependency>
@SneakyThrows
@GetMapping("/getimages")
public void asdas(HttpServletResponse response){
WxMaService wxMaService = new WxMaServiceImpl();
WxMaDefaultConfigImpl WxMaDefaultConfigImpl = new WxMaDefaultConfigImpl();
WxMaDefaultConfigImpl.setAppid(Wxpojo.appId);
WxMaDefaultConfigImpl.setSecret(Wxpojo.secret);
wxMaService.setWxMaConfig(WxMaDefaultConfigImpl);
byte[] images = wxMaService.getQrcodeService().createWxaCodeUnlimitBytes("123", "pages/index/index", 30, true, null, false);
PrintWriter out = response.getWriter();
InputStream is = new ByteArrayInputStream(images);
int a = is.read();
while (a != -1) {
out.print((char) a);
a = is.read();
}
out.flush();
out.close();
}
|