This commit is contained in:
2026-03-13 00:04:04 +08:00
parent 030d8e9e6d
commit 5972ba1948
4 changed files with 50 additions and 32 deletions

View File

@@ -76,14 +76,14 @@ func OssUpload(ctx context.Context, url, filePath string) error {
return nil
}
func UploadPreviewFile(ctx context.Context, taskId string, previewFilePath string) error {
func UploadPreviewFile(ctx context.Context, taskId string, previewFilePath string, resolution string) error {
subCtx, span := tracer.Start(ctx, "UploadPreviewFile")
defer span.End()
url, err := QueryPreviewUploadUrl(subCtx, taskId)
url, err := QueryPreviewUploadUrl(subCtx, taskId, resolution)
if err != nil {
return err
}
logger.Info("开始上传预览文件", zap.String("url", url))
logger.Info("开始上传预览文件", zap.String("url", url), zap.String("resolution", resolution))
if err := OssUpload(subCtx, url, previewFilePath); err != nil {
return err
}

View File

@@ -127,10 +127,10 @@ func ReportTaskSuccess(ctx context.Context, taskId string, file *dto.FileObject)
}
}
func QueryPreviewUploadUrl(ctx context.Context, taskId string) (string, error) {
func QueryPreviewUploadUrl(ctx context.Context, taskId string, resolution string) (string, error) {
_, span := tracer.Start(ctx, "QueryPreviewUploadUrl")
defer span.End()
url := config.Config.Api.BaseUrl + "/" + taskId + "/previewUploadUrl"
url := config.Config.Api.BaseUrl + "/" + taskId + "/previewUploadUrl?resolution=" + resolution
span.SetAttributes(attribute.String("http.url", url))
span.SetAttributes(attribute.String("http.method", "GET"))
req, err := http.NewRequest("GET", url, nil)
@@ -160,10 +160,10 @@ func QueryPreviewUploadUrl(ctx context.Context, taskId string) (string, error) {
return string(body), nil
}
func ReportPreviewSuccess(ctx context.Context, taskId string) bool {
func ReportPreviewSuccess(ctx context.Context, taskId string, resolution string) bool {
_, span := tracer.Start(ctx, "ReportPreviewSuccess")
defer span.End()
url := config.Config.Api.BaseUrl + "/" + taskId + "/previewSuccess"
url := config.Config.Api.BaseUrl + "/" + taskId + "/previewSuccess?resolution=" + resolution
span.SetAttributes(attribute.String("http.url", url))
span.SetAttributes(attribute.String("http.method", "POST"))