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

60 lines
1.8 KiB
Go
Raw Normal View History

2024-07-02 05:49:27 +08:00
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
}
//填充媒体切片
2024-07-09 21:02:18 +08:00
objectMediaNum := 2 // 单个女神认证审批服务总共3个媒体类
2024-07-02 05:49:27 +08:00
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)
}