service/app/mix/controller/streamerauthapproval_api.go

63 lines
2.0 KiB
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package controller
import (
"service/api/errcode"
streamerauthapprovalproto "service/api/proto/streamerauthapproval/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func ApiCreateStreamerAuthApproval(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovalproto.ApiCreateReq)
ec := service.DefaultService.ApiCreateStreamerAuthApproval(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
logger.Error("ApiCreateStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func ApiDeleteStreamerAuthApproval(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovalproto.ApiDeleteReq)
ec := service.DefaultService.ApiDeleteStreamerAuthApproval(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
logger.Error("ApiDeleteStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func ApiGetStreamerAuthApprovalList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovalproto.ApiListReq)
streamerauthapproval, ec := service.DefaultService.ApiGetStreamerAuthApprovalList(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
logger.Error("ApiGetStreamerAuthApprovalList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
//填充媒体切片
objectMediaNum := 5 // 单个女神认证审批服务总共5个媒体类
mediaFillableList := make([]mediafiller.MediaFillable, objectMediaNum)
mediaFillableList[0] = streamerauthapproval.Avatar
mediaFillableList[1] = streamerauthapproval.Cover
mediaFillableList[2] = streamerauthapproval.Shorts
mediaFillableList[3] = streamerauthapproval.Album
mediaFillableList[4] = streamerauthapproval.AccountShot
mediafiller.FillList(ctx, mediaFillableList)
data := &streamerauthapprovalproto.ApiListData{
StreamerAuthApproval: streamerauthapproval,
}
ReplyOk(ctx, data)
}