feat: 优化

This commit is contained in:
2026-03-02 01:28:46 +08:00
parent b2e5bb85f4
commit ce3d529f80
11 changed files with 88 additions and 33 deletions

View File

@@ -151,9 +151,8 @@ public class BatchProduceAlignment {
String dateDir = java.time.LocalDate.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd"));
String outputMediaPath = mixDirectory + "/" + dateDir + "/" + targetFileName + ".mp4";
// 使用默认的阿里云OSS endpoint格式
String bucketEndpoint = "https://" + properties.getBucket() + ".oss-" + properties.getRegionId() + ".aliyuncs.com";
String outputMediaUrl = bucketEndpoint + "/" + outputMediaPath;
// ICE写入必须使用OSS原始域名不能是CDN域名因为ICE需要写权限
String outputMediaUrl = properties.getOssWriteUrl(outputMediaPath);
// ICE需要将处理结果写入到该URL签名URL会导致写入失败
int width = 720;
@@ -374,8 +373,8 @@ public class BatchProduceAlignment {
String dateDir = java.time.LocalDate.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd"));
String outputMediaPath = mixDirectory + "/" + dateDir + "/" + targetFileName + ".mp4";
String bucketEndpoint = "https://" + properties.getBucket() + ".oss-" + properties.getRegionId() + ".aliyuncs.com";
String outputMediaUrl = bucketEndpoint + "/" + outputMediaPath;
// ICE写入必须使用OSS原始域名不能是CDN域名因为ICE需要写权限
String outputMediaUrl = properties.getOssWriteUrl(outputMediaPath);
int width = 720;
int height = 1280;

View File

@@ -53,4 +53,11 @@ public class IceProperties {
public boolean isEnabled() {
return enabled && StrUtil.isNotBlank(accessKeyId) && StrUtil.isNotBlank(accessKeySecret);
}
/**
* 获取ICE写入用的OSS URL必须使用原始域名
*/
public String getOssWriteUrl(String path) {
return "https://" + bucket + ".oss-" + regionId + ".aliyuncs.com/" + path;
}
}

View File

@@ -551,24 +551,6 @@ public class MixTaskServiceImpl implements MixTaskService {
}
}
/**
* 从OSS URL中提取相对路径
*/
private String extractPathFromUrl(String ossUrl) {
if (StrUtil.isEmpty(ossUrl)) {
return null;
}
// 查找 ".aliyuncs.com/" 的位置
int index = ossUrl.indexOf(".aliyuncs.com/");
if (index == -1) {
return null;
}
// 提取 "/" 后的路径
return ossUrl.substring(index + ".aliyuncs.com/".length());
}
/**
* 将DO分页结果转换为VO分页结果消除冗余代码
* 优化点: