使用urI

This commit is contained in:
2025-05-30 11:34:30 +08:00
parent 0d5aabe317
commit a4a6e9b5af

View File

@ -484,14 +484,14 @@ public class GoodsServiceImpl implements GoodsService {
goodsDetailVO.setGoodsId(sourceRespVO.getId());
if (sourceRespVO.getVideoUrl() != null) {
try {
URL url = URI.create(sourceRespVO.getVideoUrl()).toURL();
URI url = URI.create(sourceRespVO.getVideoUrl());
if (StringUtils.startsWith(url.getHost(), "100.64.")) {
// 内网地址,需要代理
goodsDetailVO.setVideoUrl("https://zhentuai.com/proxy?url=" + sourceRespVO.getVideoUrl());
} else {
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
}
} catch (MalformedURLException e) {
} catch (IllegalArgumentException e) {
log.warn("url地址解析异常{}", sourceRespVO.getVideoUrl(), e);
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
}