You've already forked FrameTour-BE
refactor(task): 修改任务服务中视频 URL 生成逻辑
-将视频文件名的生成方式从使用任务 ID 和创建时间改为使用任务参数进行 MD5 加密 - 这一改动可以确保即使在任务重新执行时,视频 URL 也能保持一致
This commit is contained in:
@@ -480,7 +480,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(task.getScenicId());
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(task.getScenicId());
|
||||||
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
|
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
|
||||||
String hash = MD5.create().digestHex(task.getId() + "_" + task.getCreateTime().getTime());
|
String hash = MD5.create().digestHex(task.getTaskParams());
|
||||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, hash + "_" + task.getScenicId() + ".mp4");
|
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, hash + "_" + task.getScenicId() + ".mp4");
|
||||||
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||||
videoReUploader.addVideoTask(video.getId());
|
videoReUploader.addVideoTask(video.getId());
|
||||||
@@ -549,7 +549,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
adapter = scenicService.getScenicStorageAdapter(task.getScenicId());
|
adapter = scenicService.getScenicStorageAdapter(task.getScenicId());
|
||||||
}
|
}
|
||||||
String hash = MD5.create().digestHex(task.getId() + "_" + task.getCreateTime().getTime());
|
String hash = MD5.create().digestHex(task.getTaskParams());
|
||||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, hash + "_" + task.getScenicId() + ".mp4");
|
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, hash + "_" + task.getScenicId() + ".mp4");
|
||||||
// 生成
|
// 生成
|
||||||
String url = adapter.getUrl(filename);
|
String url = adapter.getUrl(filename);
|
||||||
|
Reference in New Issue
Block a user