diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 1cd304ff..4015c3fc 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -73,9 +73,11 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeAccountRelationMustSubmitInPairs: "用户关系必须成对提交", ErrCodeAccountRelationBadPair: "用户关系对信息有误", - ErrCodeStreamerAuthApprovalSrvFail: "女神认证审批服务错误", - ErrCodeStreamerAuthApprovalNotExist: "女神认证审批不存在", - ErrCodeStreamerAuthApprovalDuplicateKey: "女神认证审批服务重复提交", + ErrCodeStreamerAuthApprovalSrvFail: "女神认证审批服务错误", + ErrCodeStreamerAuthApprovalNotExist: "女神认证审批不存在", + ErrCodeStreamerAuthApprovalDuplicateKey: "女神认证审批服务重复提交", + ErrCodeStreamerAuthApprovalInviterNotExist: "女神认证审批表邀请人不存在", + ErrCodeStreamerAuthApprovalInviterIsNotAStreamer: "女神认证审批表邀请人非主播", ErrCodeStreamerSrvFail: "主播服务错误", ErrCodeStreamerNotExist: "主播不存在", @@ -224,10 +226,12 @@ const ( ErrCodeAccountRelationBadPair ErrCode = -11007 // 用户关系对信息有误 // StreamerAuthApproval: 12xxx - ErrCodeStreamerAuthApprovalSrvOk ErrCode = ErrCodeOk - ErrCodeStreamerAuthApprovalSrvFail ErrCode = -12001 // 女神认证审批表服务错误 - ErrCodeStreamerAuthApprovalNotExist ErrCode = -12002 // 女神认证审批表不存在 - ErrCodeStreamerAuthApprovalDuplicateKey ErrCode = -12003 // 女神认证审批重复提交 + ErrCodeStreamerAuthApprovalSrvOk ErrCode = ErrCodeOk + ErrCodeStreamerAuthApprovalSrvFail ErrCode = -12001 // 女神认证审批表服务错误 + ErrCodeStreamerAuthApprovalNotExist ErrCode = -12002 // 女神认证审批表不存在 + ErrCodeStreamerAuthApprovalDuplicateKey ErrCode = -12003 // 女神认证审批重复提交 + ErrCodeStreamerAuthApprovalInviterNotExist ErrCode = -12004 // 女神认证审批表邀请人不存在 + ErrCodeStreamerAuthApprovalInviterIsNotAStreamer ErrCode = -12005 // 女神认证审批表邀请人非主播 // Streamer: 13xxx ErrCodeStreamerSrvOk ErrCode = ErrCodeOk diff --git a/app/mix/service/apiservice_business_validation.go b/app/mix/service/apiservice_business_validation.go index 10907288..6e315d11 100644 --- a/app/mix/service/apiservice_business_validation.go +++ b/app/mix/service/apiservice_business_validation.go @@ -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 }