service/app/mix/controller/streamerauthapproval_basic_...

48 lines
1.4 KiB
Go
Raw Permalink Normal View History

2024-07-09 21:02:18 +08:00
package controller
import (
"service/api/consts"
"service/api/errcode"
streamerauthapprovalbasichisproto "service/api/proto/streamerauthapprovalbasichis/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func OpGetStreamerAuthApprovalBasicHisList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovalbasichisproto.OpListReq)
//设置默认页长
if req.Limit == 0 {
req.Limit = consts.DefaultPageSize
}
list, ec := service.DefaultService.OpGetStreamerAuthApprovalBasicHisList(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalBasicSrvOk {
logger.Error("OpGetStreamerAuthApprovalBasicHisList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
//填充媒体切片
objectMediaNum := 2 // 单个女神认证审批服务总共3个媒体类
mediaFillableList := make([]mediafiller.MediaFillable, len(list)*objectMediaNum)
for i, streamerauthapprovalbasic := range list {
mediaFillableList[objectMediaNum*i+0] = streamerauthapprovalbasic.Avatar
mediaFillableList[objectMediaNum*i+1] = streamerauthapprovalbasic.AccountShot
}
mediafiller.FillList(ctx, mediaFillableList)
data := &streamerauthapprovalbasichisproto.OpListData{
List: list,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {
data.More = 1
}
ReplyOk(ctx, data)
}