Skip to content

Commit cc300b9

Browse files
committed
qrCodePictureUrl 返回网址过长,使用短网址进行压缩
1 parent 7a68fa6 commit cc300b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import java.io.StringReader;
5151
import java.io.UnsupportedEncodingException;
5252
import java.net.URLEncoder;
53-
import java.nio.charset.Charset;
5453
import java.security.NoSuchAlgorithmException;
5554
import java.util.*;
5655
import java.util.Map.Entry;
@@ -523,7 +522,8 @@ public File qrCodePicture(WxMpQrCodeTicket ticket) throws WxErrorException {
523522
public String qrCodePictureUrl(String ticket) throws WxErrorException {
524523
String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s";
525524
try {
526-
return String.format(url, URLEncoder.encode(ticket, Charsets.UTF_8.name()));
525+
return this.shortUrl(String.format(url,
526+
URLEncoder.encode(ticket, Charsets.UTF_8.name())));
527527
} catch (UnsupportedEncodingException e) {
528528
WxError error = WxError.newBuilder().setErrorCode(-1)
529529
.setErrorMsg(e.getMessage()).build();

0 commit comments

Comments
 (0)