Updata:更新接口逻辑

This commit is contained in:
jiaji.H 2025-10-16 16:02:43 +08:00
parent 8dcf0f2371
commit d86f24107c

View File

@ -96,7 +96,7 @@ func (s *VideoScanner) ScanVideoAsync(videoURL string, dataID string, serviceTyp
}
// GetVideoResult 获取视频审核结果
func (s *VideoScanner) GetVideoResult(taskID string) (*model.VideoResultResponse, error) {
func (s *VideoScanner) GetVideoResult(taskID string, serviceType VideoServiceType) (*model.VideoResultResponse, error) {
// 创建运行时配置
runtime := &util.RuntimeOptions{}
runtime.ReadTimeout = tea.Int(10000)
@ -104,7 +104,7 @@ func (s *VideoScanner) GetVideoResult(taskID string) (*model.VideoResultResponse
// 构建请求参数
videoResultRequest := &green20220302.VideoModerationResultRequest{
Service: tea.String("videoDetection_global"),
Service: tea.String(string(serviceType)),
ServiceParameters: tea.String(fmt.Sprintf(`{"taskId":"%s"}`, taskID)),
}
@ -164,7 +164,7 @@ func (s *VideoScanner) ScanVideoAndWait(videoURL string, dataID string, serviceT
// 轮询获取结果
startTime := time.Now()
for time.Since(startTime) < maxWaitTime {
result, err := s.GetVideoResult(taskID)
result, err := s.GetVideoResult(taskID, serviceType)
if err != nil {
return nil, fmt.Errorf("获取结果失败: %v", err)
}