package controller import ( "service/api/consts" "service/api/errcode" streamerauthapprovalbasicproto "service/api/proto/streamerauthapprovalbasic/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" "service/library/mediafiller" "github.com/gin-gonic/gin" ) func OpGetStreamerAuthApprovalBasicList(ctx *gin.Context) { req := ctx.MustGet("client_req").(*streamerauthapprovalbasicproto.OpListReq) //设置默认页长 if req.Limit == 0 { req.Limit = consts.DefaultPageSize } list, ec := service.DefaultService.OpGetStreamerAuthApprovalBasicList(ctx, req) if ec != errcode.ErrCodeStreamerAuthApprovalBasicSrvOk { logger.Error("OpGetStreamerAuthApprovalBasicList fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } //填充媒体切片 objectMediaNum := 2 // 单个女神认证审批服务总共5个媒体类 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 := &streamerauthapprovalbasicproto.OpListData{ List: list, Offset: req.Offset + len(list), } if len(list) >= req.Limit { data.More = 1 } ReplyOk(ctx, data) } func OpApproveStreamerAuthApprovalBasic(ctx *gin.Context) { req := ctx.MustGet("client_req").(*streamerauthapprovalbasicproto.OpApproveReq) ec := service.DefaultService.OpApproveStreamerAuthApprovalBasic(ctx, req) if ec != errcode.ErrCodeStreamerAuthApprovalBasicSrvOk { logger.Error("OpApproveStreamerAuthApprovalBasic fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, nil) }