service/app/mix/controller/streamerauthapproval_detail...

78 lines
2.7 KiB
Go

package controller
import (
"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 ApiCreateStreamerAuthApprovalDetails(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiCreateReq)
ec := service.DefaultService.ApiCreateStreamerAuthApprovalDetails(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
logger.Error("ApiCreateStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func ApiDeleteStreamerAuthApprovalDetails(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiDeleteReq)
ec := service.DefaultService.ApiDeleteStreamerAuthApprovalDetails(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
logger.Error("ApiDeleteStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}
func ApiGetStreamerAuthApprovalDetailsList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiListReq)
streamerauthapprovaldetails, ec := service.DefaultService.ApiGetStreamerAuthApprovalDetailsList(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
logger.Error("ApiGetStreamerAuthApprovalList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
//填充媒体切片
objectMediaNum := 3 // 单个女神认证审批服务总共3个媒体类
mediaFillableList := make([]mediafiller.MediaFillable, objectMediaNum)
mediaFillableList[0] = streamerauthapprovaldetails.Cover
mediaFillableList[1] = streamerauthapprovaldetails.Shorts
mediaFillableList[2] = streamerauthapprovaldetails.Album
mediafiller.FillList(ctx, mediaFillableList)
data := &streamerauthapprovaldetailsproto.ApiListData{
StreamerAuthApprovalDetailsApiVO: streamerauthapprovaldetails,
}
ReplyOk(ctx, data)
}
func ApiGetStreamerAuthApprovalApproveStatuses(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiGetApproveStatusesReq)
basicStatus, detailsStatus, ec := service.DefaultService.GetStreamerAuthApprovalStatuses(ctx, req)
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
logger.Error("GetStreamerAuthApprovalStatuses fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &streamerauthapprovaldetailsproto.ApiGetApproveStatusesData{
BasicStatus: basicStatus,
DetailsStatus: detailsStatus,
}
ReplyOk(ctx, data)
}