* @param accessToken access_token是公众号的全局唯一票据
* @param type 二维码类型,QR_SCENE为临时,QR_LIMIT_SCENE为永久
* @param sceneId 场景值ID,临时二维码时为32位整型,永久二维码时最大值为1000
*/
public Result<QRTicket> createQR(String accessToken, QRType type, Integer sceneId) {
QRCreation request = new QRCreation();
request.setType(type);
request.setSceneId(sceneId);
try {
String json =
post("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + accessToken,
new StringEntity(request.toString()));
return Result.parse(json, QRTicket.class);
} catch (UnsupportedEncodingException e) {
throw new SocialException(e);
}
}