package controller import ( "service/api/consts" "service/api/errcode" imageaudittaskproto "service/api/proto/imageaudittask/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" "service/library/mediafiller" "github.com/gin-gonic/gin" ) func OpGetImageAuditTaskList(ctx *gin.Context) { req := ctx.MustGet("client_req").(*imageaudittaskproto.OpListReq) //设置默认页长 if req.Limit == 0 { req.Limit = consts.DefaultPageSize } list, ec := service.DefaultService.OpGetImageAuditTaskVOList(ctx, req) if ec != errcode.ErrCodeImageAuditTaskSrvOk { logger.Error("OpGetImageAuditTaskList 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 := &imageaudittaskproto.OpListData{ List: list, Offset: req.Offset + len(list), } if len(list) >= req.Limit { data.More = 1 } ReplyOk(ctx, data) } func OpPassImageAuditTaskBatch(ctx *gin.Context) { req := ctx.MustGet("client_req").(*imageaudittaskproto.OpPassBatchReq) ec := service.DefaultService.OpPassImageAuditTaskBatch(ctx, req) if ec != errcode.ErrCodeImageAuditTaskSrvOk { logger.Error("OpPassImageAuditTaskBatch fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, nil) }