|
@@ -483,10 +483,29 @@ public class FodderServiceImpl extends ServiceImpl<FodderMapper,FodderEntity> im
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize(), true);
|
|
|
|
|
|
List<FodderVo> res = entityMapper.listAndDir(builder.toString());
|
|
|
+ res.forEach(item -> {
|
|
|
+ if (ObjectUtil.isNotEmpty(item.getIcon())){
|
|
|
+ //判断url是否有//换成一个/,但是https://的2个不需要移除
|
|
|
+ item.setIcon(normalizeSlashesExceptProtocol(item.getIcon()));
|
|
|
+ }
|
|
|
+ });
|
|
|
PageInfo<FodderVo> pageInfo = new PageInfo<>(res);
|
|
|
|
|
|
return Result.success(pageInfo);
|
|
|
}
|
|
|
+ public static String normalizeSlashesExceptProtocol(String url) {
|
|
|
+ if (url == null || url.isEmpty()) {
|
|
|
+ return url;
|
|
|
+ }
|
|
|
+ // 先分割协议部分和剩余路径
|
|
|
+ if (url.startsWith("http://")) {
|
|
|
+ return "http://" + url.substring(7).replaceAll("/+", "/");
|
|
|
+ } else if (url.startsWith("https://")) {
|
|
|
+ return "https://" + url.substring(8).replaceAll("/+", "/");
|
|
|
+ } else {
|
|
|
+ return url.replaceAll("/+", "/");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// /**
|
|
|
// * 2022-12-20 记录用户登录-数据统计使用
|