admin
2018-12-19 b91b38942de4a865f105c4ca1e7d5ffce1b60b66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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());
    }
 
}