service/app/mix/controller/streamerauthapproval_detail...

43 lines
1.4 KiB
Go
Raw Normal View History

2024-07-09 21:02:18 +08:00
package controller
import (
"service/api/errcode"
streamerauthapprovaldetailshisproto "service/api/proto/streamerauthapprovaldetailshis/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func ApiGetStreamerAuthApprovalDetailsHisList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailshisproto.ApiListReq)
list, ec := service.DefaultService.ApiGetStreamerAuthApprovalDetailsHisList(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
logger.Error("ApiGetStreamerAuthApprovalList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
//填充媒体切片
objectMediaNum := 3 // 单个女神认证审批服务总共3个媒体类
mediaFillableList := make([]mediafiller.MediaFillable, len(list)*objectMediaNum)
for i, streamerauthapprovaldetails := range list {
mediaFillableList[objectMediaNum*i+0] = streamerauthapprovaldetails.Cover
mediaFillableList[objectMediaNum*i+1] = streamerauthapprovaldetails.Shorts
mediaFillableList[objectMediaNum*i+2] = streamerauthapprovaldetails.Album
}
mediafiller.FillList(ctx, mediaFillableList)
data := &streamerauthapprovaldetailshisproto.ApiListData{
List: list,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {
data.More = 1
}
ReplyOk(ctx, data)
}