package org.yeshi.utils.wx; import java.io.InputStream; import org.yeshi.utils.HttpUtil; import net.sf.json.JSONObject; public class WXXCXUtil { public static InputStream getXCXCode(String accessToken, String path, String scene) { String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; JSONObject data = new JSONObject(); data.put("scene", "123123,12312321123"); data.put("page", path); // JSONObject color = new JSONObject(); // color.put("r", ); // color.put("g", ); // color.put("b", ); // // data.put("line_color", color); return HttpUtil.postForInputstream(url, data.toString()); } // 获取有限的小程序码 public static InputStream getLimitXCXCode(String accessToken, String path) { String url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + accessToken; JSONObject data = new JSONObject(); data.put("path", path); data.put("width", 500); return HttpUtil.postForInputstream(url, data.toString()); } }