mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 22:11:40 +08:00
qrCodePictureUrl 返回网址过长,使用短网址进行压缩
This commit is contained in:
parent
7a68fa6853
commit
cc300b93d0
@ -50,7 +50,6 @@ import java.io.InputStream;
|
|||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -523,7 +522,8 @@ public class WxMpServiceImpl implements WxMpService {
|
|||||||
public String qrCodePictureUrl(String ticket) throws WxErrorException {
|
public String qrCodePictureUrl(String ticket) throws WxErrorException {
|
||||||
String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s";
|
String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s";
|
||||||
try {
|
try {
|
||||||
return String.format(url, URLEncoder.encode(ticket, Charsets.UTF_8.name()));
|
return this.shortUrl(String.format(url,
|
||||||
|
URLEncoder.encode(ticket, Charsets.UTF_8.name())));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
WxError error = WxError.newBuilder().setErrorCode(-1)
|
WxError error = WxError.newBuilder().setErrorCode(-1)
|
||||||
.setErrorMsg(e.getMessage()).build();
|
.setErrorMsg(e.getMessage()).build();
|
||||||
|
Loading…
Reference in New Issue
Block a user