package controller import ( "service/api/consts" "service/api/errcode" moment_audit_taskproto "service/api/proto/moment_audit_task/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" "service/library/mediafiller" "github.com/gin-gonic/gin" ) func OpGetMomentAuditTaskList(ctx *gin.Context) { req := ctx.MustGet("client_req").(*moment_audit_taskproto.OpListReq) //设置默认页长 if req.Limit == 0 { req.Limit = consts.DefaultPageSize } list, ec := service.DefaultService.OpGetMomentAuditTaskList(ctx, req) if ec != errcode.ErrCodeMomentAuditTaskSrvOk { logger.Error("OpGetMomentAuditTaskList fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } //填充媒体切片 objectMediaNum := 2 // mediaFillableList := make([]mediafiller.MediaFillable, len(list)*objectMediaNum) for i, task := range list { mediaFillableList[objectMediaNum*i+0] = task.MomentAuditTask.AuditedMedia mediaFillableList[objectMediaNum*i+1] = task.MomentAuditTask.FinalMedia } mediafiller.FillList(ctx, mediaFillableList) data := &moment_audit_taskproto.OpListData{ List: list, Offset: req.Offset + len(list), } if len(list) >= req.Limit { data.More = 1 } ReplyOk(ctx, data) }