service/app/mix/controller/alignedaudittask_op.go

48 lines
1.2 KiB
Go
Raw Normal View History

2024-02-07 12:07:28 +08:00
package controller
import (
"service/api/consts"
"service/api/errcode"
alignedaudittaskproto "service/api/proto/alignedaudittask/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func OpGetAlignedAuditTaskList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*alignedaudittaskproto.OpListReq)
//设置默认页长
if req.Limit == 0 {
req.Limit = consts.DefaultPageSize
}
list, ec := service.DefaultService.OpGetAlignedAuditTaskVOList(ctx, req)
if ec != errcode.ErrCodeAlignedAuditTaskSrvOk {
logger.Error("OpGetAlignedAuditTaskList 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.ImageAuditTaskVO.AuditedMedia
mediaFillableList[objectMediaNum*i+1] = task.ImageAuditTaskVO.OldMedia
}
mediafiller.FillList(ctx, mediaFillableList)
data := &alignedaudittaskproto.OpListData{
List: list,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {
data.More = 1
}
ReplyOk(ctx, data)
}