99 lines
3.2 KiB
Go
99 lines
3.2 KiB
Go
|
package controller
|
||
|
|
||
|
import (
|
||
|
"service/api/consts"
|
||
|
"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 OpCreateStreamerAuthApproval(ctx *gin.Context) {
|
||
|
// req := ctx.MustGet("client_req").(*streamerauthapprovalproto.OpCreateReq)
|
||
|
// ec := service.DefaultService.OpCreateStreamerAuthApproval(ctx, req)
|
||
|
// if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||
|
// logger.Error("OpCreateStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||
|
// ReplyErrCodeMsg(ctx, ec)
|
||
|
// return
|
||
|
// }
|
||
|
|
||
|
// ReplyOk(ctx, nil)
|
||
|
// }
|
||
|
|
||
|
// func OpUpdateStreamerAuthApproval(ctx *gin.Context) {
|
||
|
// req := ctx.MustGet("client_req").(*streamerauthapprovalproto.OpUpdateReq)
|
||
|
// ec := service.DefaultService.OpUpdateStreamerAuthApproval(ctx, req)
|
||
|
// if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||
|
// logger.Error("OpUpdateStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||
|
// ReplyErrCodeMsg(ctx, ec)
|
||
|
// return
|
||
|
// }
|
||
|
|
||
|
// ReplyOk(ctx, nil)
|
||
|
// }
|
||
|
|
||
|
// func OpDeleteBatchStreamerAuthApproval(ctx *gin.Context) {
|
||
|
// req := ctx.MustGet("client_req").(*streamerauthapprovalproto.OpDeleteBatchReq)
|
||
|
// ec := service.DefaultService.OpDeleteBatchStreamerAuthApproval(ctx, req.Ids)
|
||
|
// if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||
|
// logger.Error("OpDeleteStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||
|
// ReplyErrCodeMsg(ctx, ec)
|
||
|
// return
|
||
|
// }
|
||
|
|
||
|
// ReplyOk(ctx, nil)
|
||
|
// }
|
||
|
|
||
|
func OpGetStreamerAuthApprovalList(ctx *gin.Context) {
|
||
|
req := ctx.MustGet("client_req").(*streamerauthapprovalproto.OpListReq)
|
||
|
|
||
|
//设置默认页长
|
||
|
if req.Limit == 0 {
|
||
|
req.Limit = consts.DefaultPageSize
|
||
|
}
|
||
|
|
||
|
list, ec := service.DefaultService.OpGetStreamerAuthApprovalList(ctx, req)
|
||
|
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||
|
logger.Error("OpGetStreamerAuthApprovalList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||
|
ReplyErrCodeMsg(ctx, ec)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
//填充媒体切片
|
||
|
objectMediaNum := 5 // 单个女神认证审批服务总共5个媒体类
|
||
|
mediaFillableList := make([]mediafiller.MediaFillable, len(list)*objectMediaNum)
|
||
|
for i, streamerauthapproval := range list {
|
||
|
mediaFillableList[objectMediaNum*i+0] = streamerauthapproval.Avatar
|
||
|
mediaFillableList[objectMediaNum*i+1] = streamerauthapproval.Cover
|
||
|
mediaFillableList[objectMediaNum*i+2] = streamerauthapproval.Shorts
|
||
|
mediaFillableList[objectMediaNum*i+3] = streamerauthapproval.Album
|
||
|
mediaFillableList[objectMediaNum*i+4] = streamerauthapproval.AccountShot
|
||
|
}
|
||
|
mediafiller.FillList(ctx, mediaFillableList)
|
||
|
|
||
|
data := &streamerauthapprovalproto.OpListData{
|
||
|
List: list,
|
||
|
Offset: req.Offset + len(list),
|
||
|
}
|
||
|
if len(list) >= req.Limit {
|
||
|
data.More = 1
|
||
|
}
|
||
|
ReplyOk(ctx, data)
|
||
|
}
|
||
|
|
||
|
func OpApproveStreamerAuthApproval(ctx *gin.Context) {
|
||
|
req := ctx.MustGet("client_req").(*streamerauthapprovalproto.OpApproveReq)
|
||
|
ec := service.DefaultService.OpApproveStreamerAuthApproval(ctx, req)
|
||
|
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||
|
logger.Error("OpApproveStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||
|
ReplyErrCodeMsg(ctx, ec)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
ReplyOk(ctx, nil)
|
||
|
}
|