private InputStream getUnLimit(String scene, String path, int width, boolean autoColor, Map<String, String> lineColor) { Kv kv = Kv.by("path", path) .set("scene", scene) .set("width", String.valueOf(width)) .set("auto_color", autoColor) .set("line_color", lineColor); String url = getWxaCodeUnLimitURL + WxaAccessTokenApi.getAccessTokenStr(); return HttpUtils.download(url, JsonUtils.toJson(kv)); }
这里的“path”,微信要求的是传“page”
文档链接: https://developers.weixin.qq.com/miniprogram/dev/api/getWXACodeUnlimit.html
还有就是生成二维码的宽度,全部是430,在方法里面写死了
eg:
public InputStream getUnLimit(String scene, String path, int width, String r, String g, String b) { Map<String, String> lineColor = new HashMap<String, String>(); lineColor.put("r", r); lineColor.put("g", g); lineColor.put("b", b); return getUnLimit(scene, path, 430, false, lineColor); } public InputStream get(String path, int width, String r, String g, String b) { Map<String, String> lineColor = new HashMap<String, String>(); lineColor.put("r", r); lineColor.put("g", g); lineColor.put("b", b); return get(path, 430, false, lineColor); }
@JFinal 波总,有时间改下这个