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

42 lines
1.3 KiB
Go

package controller
import (
"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 ApiGetStreamerAuthApprovalBasicHisList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovalbasichisproto.ApiListReq)
list, ec := service.DefaultService.ApiGetStreamerAuthApprovalBasicHisList(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalBasicSrvOk {
logger.Error("ApiGetStreamerAuthApprovalBasicHisList 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, streamerauthapprovaldetails := range list {
mediaFillableList[objectMediaNum*i+0] = streamerauthapprovaldetails.Avatar
mediaFillableList[objectMediaNum*i+1] = streamerauthapprovaldetails.AccountShot
}
mediafiller.FillList(ctx, mediaFillableList)
data := &streamerauthapprovalbasichisproto.ApiListData{
List: list,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {
data.More = 1
}
ReplyOk(ctx, data)
}