by Robin at 20231224; inviter

This commit is contained in:
Leufolium 2023-12-24 02:02:20 +08:00
parent f3520a506c
commit 87cf6ecb49
2 changed files with 26 additions and 7 deletions

View File

@ -76,6 +76,8 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeStreamerAuthApprovalSrvFail: "女神认证审批服务错误",
ErrCodeStreamerAuthApprovalNotExist: "女神认证审批不存在",
ErrCodeStreamerAuthApprovalDuplicateKey: "女神认证审批服务重复提交",
ErrCodeStreamerAuthApprovalInviterNotExist: "女神认证审批表邀请人不存在",
ErrCodeStreamerAuthApprovalInviterIsNotAStreamer: "女神认证审批表邀请人非主播",
ErrCodeStreamerSrvFail: "主播服务错误",
ErrCodeStreamerNotExist: "主播不存在",
@ -228,6 +230,8 @@ const (
ErrCodeStreamerAuthApprovalSrvFail ErrCode = -12001 // 女神认证审批表服务错误
ErrCodeStreamerAuthApprovalNotExist ErrCode = -12002 // 女神认证审批表不存在
ErrCodeStreamerAuthApprovalDuplicateKey ErrCode = -12003 // 女神认证审批重复提交
ErrCodeStreamerAuthApprovalInviterNotExist ErrCode = -12004 // 女神认证审批表邀请人不存在
ErrCodeStreamerAuthApprovalInviterIsNotAStreamer ErrCode = -12005 // 女神认证审批表邀请人非主播
// Streamer: 13xxx
ErrCodeStreamerSrvOk ErrCode = ErrCodeOk

View File

@ -13,6 +13,8 @@ import (
"service/dbstruct"
"service/library/logger"
goproto "google.golang.org/protobuf/proto"
"github.com/gin-gonic/gin"
)
@ -398,6 +400,19 @@ func (s *Service) ApiCreateStreamerAuthApprovalBusinessValidate(ctx *gin.Context
return
}
inviters := util.DerefInt64Slice(req.Inviters)
if len(inviters) > 0 {
account, _ := _DefaultAccount.OpListByUserId(ctx, &accountproto.OpListByUserIdReq{
UserId: goproto.Int64(inviters[0]),
})
if account == nil {
return errcode.ErrCodeStreamerAuthApprovalInviterNotExist
}
if util.DerefInt64(account.Role) != consts.Streamer {
return errcode.ErrCodeStreamerAuthApprovalInviterIsNotAStreamer
}
}
return
}