按照微信提供的生成带参数的小程序码后,小程序上线。扫描生成的带参数的小程序码,为啥不进入指定的页面还是进入到小程序的首页呢?是需要配置什么吗?
URL url = new URL(“https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=” + accessToken);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod(“POST”);// 提交模式
httpURLConnection.setRequestProperty(“Content-Type”, “application/json”);
// httpURLConnection.setConnectTimeout(90000);//连接超时 单位毫秒
// httpURLConnection.setReadTimeout(2000);//读取超时 单位毫秒
// 发送POST请求必须设置如下两行
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
// 获取URLConnection对象对应的输出流
PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());
// 发送请求参数
JSONObject paramJson = new JSONObject();
paramJson.put(“scene”, sceneStr);
paramJson.put(“path”, xcxUrl);
paramJson.put(“width”, 120);
//paramJson.put(“auto_color”, true);
paramJson.put(“auto_color”, false);
JSONObject lineColor = new JSONObject();
lineColor.put(“r”, 0);
lineColor.put(“g”, 0);
lineColor.put(“b”, 0);
paramJson.put(“line_color”, lineColor);
printWriter.write(paramJson.toString());
// flush输出流的缓冲
printWriter.flush();
// 开始获取数据
BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream());