本文整理了Java中me.chanjar.weixin.mp.api.WxMpService.shortUrl()
方法的一些代码示例,展示了WxMpService.shortUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WxMpService.shortUrl()
方法的具体详情如下:
包路径:me.chanjar.weixin.mp.api.WxMpService
类名称:WxMpService
方法名:shortUrl
[英]```
长链接转短链接接口
详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口
[中]```
长链接转短链接接口
详情请见: http://mp.weixin.qq.com/wiki/index.php?title=长链接转短链接接口
代码示例来源:origin: aillamsun/genesis
/**
* @param @param longUrl
* @param @return
* @param @throws WxErrorException 参数
* @return String 返回类型
* @throws
* @Title: getShortUrl
* @Description: TODO 获取短链接
*/
public static String getShortUrl(String longUrl) {
try {
return WxMpServiceFactory.getWxMpService().shortUrl(longUrl);
} catch (WxErrorException e) {
e.printStackTrace();
return "";
}
}
代码示例来源:origin: binarywang/WxJava
@Override
public String qrCodePictureUrl(String ticket, boolean needShortUrl) throws WxErrorException {
String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s";
try {
String resultUrl = String.format(url,
URLEncoder.encode(ticket, StandardCharsets.UTF_8.name()));
if (needShortUrl) {
return this.wxMpService.shortUrl(resultUrl);
}
return resultUrl;
} catch (UnsupportedEncodingException e) {
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build());
}
}
代码示例来源:origin: com.github.binarywang/weixin-java-mp
@Override
public String qrCodePictureUrl(String ticket, boolean needShortUrl) throws WxErrorException {
String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s";
try {
String resultUrl = String.format(url,
URLEncoder.encode(ticket, StandardCharsets.UTF_8.name()));
if (needShortUrl) {
return this.wxMpService.shortUrl(resultUrl);
}
return resultUrl;
} catch (UnsupportedEncodingException e) {
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg(e.getMessage()).build());
}
}
内容来源于网络,如有侵权,请联系作者删除!