Updata:更新视频审核逻辑
This commit is contained in:
parent
f132960772
commit
5d73acb225
@ -177,9 +177,13 @@ func (s *ImageScanner) ScanImageByFile(filePath string, dataID string, serviceTy
|
||||
scanData := model.ImageScanData{
|
||||
DataID: dataID,
|
||||
Code: tea.Int32Value(response.Body.Code),
|
||||
Message: "success",
|
||||
Results: make([]*green20220302.ImageModerationResponseBodyDataResult, 0),
|
||||
}
|
||||
if response.Body.Code == tea.Int32(200) {
|
||||
scanData.Message = "success"
|
||||
} else {
|
||||
scanData.Message = tea.StringValue(response.Body.Msg)
|
||||
}
|
||||
|
||||
// 如果有结果数据,进行转换
|
||||
if response.Body.Data != nil {
|
||||
|
@ -195,17 +195,3 @@ func (s *TextScanner) PrintResult(response *model.TextScanResponse) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetSuggestionText 获取建议文本
|
||||
func GetSuggestionText(suggestion string) string {
|
||||
switch suggestion {
|
||||
case "pass":
|
||||
return "通过"
|
||||
case "review":
|
||||
return "需要人工审核"
|
||||
case "block":
|
||||
return "拒绝"
|
||||
default:
|
||||
return suggestion
|
||||
}
|
||||
}
|
||||
|
@ -83,8 +83,8 @@ func (s *VideoScanner) ScanVideoAsync(videoURL string, dataID string, serviceTyp
|
||||
|
||||
// 创建单个数据项
|
||||
scanData := model.VideoScanData{
|
||||
DataID: dataID,
|
||||
TaskID: fmt.Sprintf("task_%s_%d", dataID, time.Now().Unix()),
|
||||
DataID: tea.StringValue(response.Body.Data.DataId),
|
||||
TaskID: tea.StringValue(response.Body.Data.TaskId),
|
||||
Code: tea.Int32Value(response.Body.Code),
|
||||
Message: tea.StringValue(response.Body.Message),
|
||||
URL: videoURL,
|
||||
@ -104,7 +104,7 @@ func (s *VideoScanner) GetVideoResult(taskID string) (*model.VideoResultResponse
|
||||
|
||||
// 构建请求参数
|
||||
videoResultRequest := &green20220302.VideoModerationResultRequest{
|
||||
Service: tea.String("videoDetection"),
|
||||
Service: tea.String("videoDetection_global"),
|
||||
ServiceParameters: tea.String(fmt.Sprintf(`{"taskId":"%s"}`, taskID)),
|
||||
}
|
||||
|
||||
@ -123,15 +123,21 @@ func (s *VideoScanner) GetVideoResult(taskID string) (*model.VideoResultResponse
|
||||
|
||||
// 创建单个数据项
|
||||
resultData := model.VideoResultData{
|
||||
DataID: tea.StringValue(response.Body.Data.DataId),
|
||||
TaskID: tea.StringValue(response.Body.Data.TaskId),
|
||||
Code: tea.Int32Value(response.Body.Code),
|
||||
Message: tea.StringValue(response.Body.Message),
|
||||
Status: "success",
|
||||
}
|
||||
if tea.StringValue(response.Body.Message) == "SUCCESS" {
|
||||
resultData.Status = "success"
|
||||
} else if tea.StringValue(response.Body.Message) == "PROCESSING" {
|
||||
resultData.Status = "running"
|
||||
} else {
|
||||
resultData.Status = "failure"
|
||||
}
|
||||
|
||||
// 如果有结果数据,进行转换
|
||||
if response.Body.Data != nil {
|
||||
resultData.DataID = tea.StringValue(response.Body.Data.DataId)
|
||||
resultData.TaskID = tea.StringValue(response.Body.Data.TaskId)
|
||||
resultData.Results = response.Body.Data
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user