service/app/mix/controller/video_moderation_callback.go

38 lines
1.1 KiB
Go

package controller
import (
video_moderation_proto "service/api/proto/video_moderation/proto"
"service/app/mix/service"
"service/bizcommon/util"
videomoderation "service/library/contentaudit/video_moderation"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func VideoModerationCallback(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*video_moderation_proto.ExtVideoModerationReq)
err := videomoderation.VerifySign(req)
if err != nil {
logger.Error("VerifySign fail, req: %v, err: %v", util.ToJson(req), err)
return
}
batchId, isBatchFinished, err := videomoderation.HandleVideoModerationContent(req.Content)
if err != nil {
logger.Error("HandleVideoModerationContent fail, req: %v, err: %v", util.ToJson(req), err)
return
}
// 同步批次视频审核结果
if isBatchFinished {
err = service.DefaultService.SyncVideoModerationTaskResultByBatchId(&gin.Context{}, batchId)
if err != nil {
logger.Error("ERROR : batchId : %v, video moderation tasks of this batchId have failed to syncronize, err :%v", batchId, err)
}
}
ctx.String(200, "success")
}