fix:修复问题如下:
1. 小程序登录新增MINI参数,解决多个Appid问题 2. 新增文件预热功能,测试通过 3. 订单支付逻辑更新完成 4. 数据冷热切换功能发布更新 5. 订单素材上传完成后批量文件cdn预热,提升访问性能
This commit is contained in:
+4
-4
@@ -168,8 +168,8 @@ public class OrderController {
|
||||
Map<String,String> imgMap = new HashMap<>();
|
||||
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
|
||||
// 去掉URL中的参数并替换域名
|
||||
String cleanUrl = removeUrlParams(url.replace(cdnOssUrl, cdnUrl));
|
||||
imgMap.put("url", cleanUrl);
|
||||
// String cleanUrl = removeUrlParams(url.replace(cdnOssUrl, cdnUrl));
|
||||
imgMap.put("url", url.replace(cdnOssUrl, cdnUrl));
|
||||
imgMap.put("contentType", orderFile.getFileType());
|
||||
fileMap.put("path",orderFile.getFilePath());
|
||||
imgMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
@@ -620,8 +620,8 @@ public class OrderController {
|
||||
Map<String, String> fileInfo = new HashMap<>();
|
||||
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
|
||||
// 去掉URL中的参数并替换域名
|
||||
String cleanUrl = removeUrlParams(url.replace(cdnOssUrl, cdnUrl));
|
||||
fileInfo.put("url", cleanUrl);
|
||||
// String cleanUrl = removeUrlParams(url.replace(cdnOssUrl, cdnUrl));
|
||||
fileInfo.put("url", url.replace(cdnOssUrl, cdnUrl));
|
||||
fileInfo.put("contentType", orderFile.getFileType());
|
||||
fileMap.put("path", orderFile.getFilePath());
|
||||
fileInfo.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
|
||||
+26
-2
@@ -63,6 +63,12 @@ public class OrderFileController {
|
||||
@Value("${cdn.prefetch.area:domestic}")
|
||||
private String cdnPrefetchArea;
|
||||
|
||||
@Value("${file.oss-url}")
|
||||
private String cdnOssUrl;
|
||||
|
||||
@Value("${file.cdn-url}")
|
||||
private String cdnUrl;
|
||||
|
||||
@Autowired
|
||||
private UserCenterService userCenterService;
|
||||
|
||||
@@ -364,8 +370,10 @@ public class OrderFileController {
|
||||
try {
|
||||
String viewUrl = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
|
||||
if (viewUrl != null && !viewUrl.trim().isEmpty()) {
|
||||
fileUrls.add(viewUrl);
|
||||
log.debug("添加文件URL到预热列表: {}", viewUrl);
|
||||
// 替换OSS域名为CDN域名,并移除URL参数
|
||||
String cleanUrl = viewUrl.replace(cdnOssUrl, cdnUrl);
|
||||
fileUrls.add(cleanUrl);
|
||||
log.debug("添加文件URL到预热列表: {}", cleanUrl);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取文件URL失败,文件路径: {}", orderFile.getFilePath(), e);
|
||||
@@ -395,6 +403,22 @@ public class OrderFileController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除URL中的参数
|
||||
* @param url 原始URL
|
||||
* @return 移除参数后的URL
|
||||
*/
|
||||
private String removeUrlParams(String url) {
|
||||
if (url == null || url.isEmpty()) {
|
||||
return url;
|
||||
}
|
||||
int questionMarkIndex = url.indexOf('?');
|
||||
if (questionMarkIndex != -1) {
|
||||
return url.substring(0, questionMarkIndex);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "删除文件")
|
||||
@DeleteMapping( "/{id}")
|
||||
|
||||
Reference in New Issue
Block a user