|
@@ -46,6 +46,8 @@ import java.io.File; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
import java.io.StringReader; |
|
|
import java.io.StringReader; |
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
import java.security.NoSuchAlgorithmException; |
|
|
import java.security.NoSuchAlgorithmException; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.Map.Entry; |
|
|
import java.util.Map.Entry; |
|
@@ -472,6 +474,19 @@ public class WxMpServiceImpl implements WxMpService { |
|
|
return execute(new QrCodeRequestExecutor(), url, ticket); |
|
|
return execute(new QrCodeRequestExecutor(), url, ticket); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public String qrCodePictureUrl(String ticket) throws WxErrorException { |
|
|
|
|
|
String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s"; |
|
|
|
|
|
try { |
|
|
|
|
|
return String.format(url, URLEncoder.encode(ticket, "utf-8")); |
|
|
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
|
|
WxError error = new WxError(); |
|
|
|
|
|
error.setErrorCode(-1); |
|
|
|
|
|
error.setErrorMsg(e.getMessage()); |
|
|
|
|
|
throw new WxErrorException(error); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public String shortUrl(String long_url) throws WxErrorException { |
|
|
public String shortUrl(String long_url) throws WxErrorException { |
|
|
String url = "https://api.weixin.qq.com/cgi-bin/shorturl"; |
|
|
String url = "https://api.weixin.qq.com/cgi-bin/shorturl"; |
|
|
JsonObject o = new JsonObject(); |
|
|
JsonObject o = new JsonObject(); |
|
|