|
@@ -6006,6 +6006,12 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
List<String> storeAlbumUrlList = storeAlbumList.stream().map(StoreImg::getImgUrl) // 假设 StoreImg 有 getStoreUrl() 方法
|
|
List<String> storeAlbumUrlList = storeAlbumList.stream().map(StoreImg::getImgUrl) // 假设 StoreImg 有 getStoreUrl() 方法
|
|
|
.filter(url -> url != null && !url.trim().isEmpty()) // 过滤空值
|
|
.filter(url -> url != null && !url.trim().isEmpty()) // 过滤空值
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
+ // 相册首项为视频时,在列表首位插入商家入口图,供客户端展示封面
|
|
|
|
|
+ String firstAlbumUrl = storeAlbumUrlList.get(0);
|
|
|
|
|
+ if (isVideoUrl(firstAlbumUrl)) {
|
|
|
|
|
+ String image = firstAlbumUrl + "?x-oss-process=video/snapshot,t_0,f_jpg,w_800,h_600,m_fast,ar_auto";
|
|
|
|
|
+ storeAlbumUrlList.add(image);
|
|
|
|
|
+ }
|
|
|
result.setStoreAlbumUrlList(storeAlbumUrlList);
|
|
result.setStoreAlbumUrlList(storeAlbumUrlList);
|
|
|
} else {
|
|
} else {
|
|
|
result.setStoreAlbumUrlList(new ArrayList<>());
|
|
result.setStoreAlbumUrlList(new ArrayList<>());
|
|
@@ -7961,6 +7967,32 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 判断 URL 是否为视频(按常见视频后缀,忽略查询参数)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param url 资源地址
|
|
|
|
|
+ * @return 是否为视频
|
|
|
|
|
+ */
|
|
|
|
|
+ private boolean isVideoUrl(String url) {
|
|
|
|
|
+ if (StringUtils.isEmpty(url)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ String path = url;
|
|
|
|
|
+ int queryIndex = path.indexOf('?');
|
|
|
|
|
+ if (queryIndex > 0) {
|
|
|
|
|
+ path = path.substring(0, queryIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+ String lowerPath = path.toLowerCase();
|
|
|
|
|
+ return lowerPath.endsWith(".mp4")
|
|
|
|
|
+ || lowerPath.endsWith(".avi")
|
|
|
|
|
+ || lowerPath.endsWith(".flv")
|
|
|
|
|
+ || lowerPath.endsWith(".mkv")
|
|
|
|
|
+ || lowerPath.endsWith(".rmvb")
|
|
|
|
|
+ || lowerPath.endsWith(".wmv")
|
|
|
|
|
+ || lowerPath.endsWith(".3gp")
|
|
|
|
|
+ || lowerPath.endsWith(".mov");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|