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