service/app/mix/controller/videomoderationtask_op.go

61 lines
1.7 KiB
Go
Raw Permalink Normal View History

2024-07-17 12:01:56 +08:00
package controller
import (
"service/api/consts"
"service/api/errcode"
videomoderationtaskproto "service/api/proto/video_moderation_task/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func OpGetVideoModerationTaskList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*videomoderationtaskproto.OpListReq)
//设置默认页长
if req.Limit == 0 {
req.Limit = consts.DefaultPageSize
}
list, ec := service.DefaultService.OpGetVideoModerationTaskVOList(ctx, req)
if ec != errcode.ErrCodeVideoModerationTaskSrvOk {
logger.Error("OpGetVideoModerationTaskList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
//填充媒体切片
objectMediaNum := 2 // 单个主播服务总共4个媒体类
mediaFillableList := make([]mediafiller.MediaFillable, len(list)*objectMediaNum)
for i, task := range list {
mediaFillableList[objectMediaNum*i+0] = task.AuditedMedia
mediaFillableList[objectMediaNum*i+1] = task.OldMedia
}
mediafiller.FillList(ctx, mediaFillableList)
data := &videomoderationtaskproto.OpListData{
List: list,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {
data.More = 1
}
ReplyOk(ctx, data)
}
func OpReviewVideoModerationTaskBatch(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*videomoderationtaskproto.OpReviewBatchReq)
ec := service.DefaultService.OpReviewVideoModerationTaskBatch(ctx, req)
if ec != errcode.ErrCodeVideoModerationTaskSrvOk {
logger.Error("OpPassVideoModerationTaskBatch fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}