package controller import ( "service/api/consts" "service/api/errcode" streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" "service/library/mediafiller" "github.com/gin-gonic/gin" ) func OpGetStreamerAuthApprovalDetailsList(ctx *gin.Context) { req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.OpListReq) //设置默认页长 if req.Limit == 0 { req.Limit = consts.DefaultPageSize } list, ec := service.DefaultService.OpGetStreamerAuthApprovalDetailsList(ctx, req) if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk { logger.Error("OpGetStreamerAuthApprovalDetailsList 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 := &streamerauthapprovaldetailsproto.OpListData{ List: list, Offset: req.Offset + len(list), } if len(list) >= req.Limit { data.More = 1 } ReplyOk(ctx, data) } func OpApproveStreamerAuthApprovalDetails(ctx *gin.Context) { req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.OpApproveReq) ec := service.DefaultService.OpApproveStreamerAuthApprovalDetails(ctx, req) if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk { logger.Error("OpApproveStreamerAuthApprovalDetails fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, nil) }