Merge branch 'feat-IRONFANS-229-Robin' into conflict

This commit is contained in:
Leufolium 2024-10-11 15:26:52 +08:00
commit 5295ffb251
3 changed files with 24 additions and 7 deletions

View File

@ -145,9 +145,10 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeHandleWsFail: "",
ErrCodeMediaSrvFail: "媒体服务错误",
ErrCodeMediaNotExist: "媒体不存在",
ErrCodeMediaUploadFail: "媒体上传失败",
ErrCodeMediaSrvFail: "媒体服务错误",
ErrCodeMediaNotExist: "媒体不存在",
ErrCodeMediaUploadFail: "媒体上传失败",
ErrCodeMediaVideoMustBeUnique: "只能上传一个视频,请删除多余视频",
ErrCodeImageAuditTaskSrvFail: "图像审核任务服务错误",
ErrCodeImageAuditTaskNotExist: "图像审核任务不存在",
@ -608,10 +609,11 @@ const (
ErrCodeNotificationCountRedisCacheInvalid ErrCode = -46003 // 系统通知表redis缓存失效
// Media: 60xxx
ErrCodeMediaSrvOk ErrCode = ErrCodeOk
ErrCodeMediaSrvFail ErrCode = -60001 // 媒体服务错误
ErrCodeMediaNotExist ErrCode = -60002 // 媒体不存在
ErrCodeMediaUploadFail ErrCode = -60003 // 媒体上传失败
ErrCodeMediaSrvOk ErrCode = ErrCodeOk
ErrCodeMediaSrvFail ErrCode = -60001 // 媒体服务错误
ErrCodeMediaNotExist ErrCode = -60002 // 媒体不存在
ErrCodeMediaUploadFail ErrCode = -60003 // 媒体上传失败
ErrCodeMediaVideoMustBeUnique ErrCode = -60004 // 视频必须唯一
// Hvyogo: 61xxx
ErrCodeHvyogoSrvOk ErrCode = ErrCodeOk

View File

@ -592,6 +592,7 @@ func (s *Service) ApiCreateMomentBusinessValidate(ctx *gin.Context, req *momentp
QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist().
EnsureIsThisRole(consts.Streamer).
EnsureVideoIsUnique(req.Moment.MediaComp).
EnsureMediaIsSuccessfullyUploaded(req.Moment.MediaComp).
EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, consts.AccountPunishment_BlockFromCreatingMoment, _DefaultAccountPunishment.OpListByMidAndType).
QueryMomentCreateTimes(_DefaultMomentCreateTimes.OpGetAndUpdate, req.GetBaseRequest().Mid).
@ -616,6 +617,7 @@ func (s *Service) ApiUpdateMomentBusinessValidate(ctx *gin.Context, req *momentp
QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist().
EnsureIsThisRole(consts.Streamer).
EnsureVideoIsUnique(req.Moment.MediaComp).
EnsureMediaIsSuccessfullyUploaded(req.Moment.MediaComp).
Validate().
Collect()
@ -645,6 +647,7 @@ func (s *Service) ApiCreateZoneMomentBusinessValidate(ctx *gin.Context, req *zon
QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist().
EnsureIsThisRole(consts.Streamer).
EnsureVideoIsUnique(req.ZoneMoment.MediaComp).
EnsureMediaIsSuccessfullyUploaded(req.ZoneMoment.MediaComp).
EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, consts.AccountPunishment_BlockFromCreatingZoneMoment, _DefaultAccountPunishment.OpListByMidAndType).
EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, pType, _DefaultAccountPunishment.OpListByMidAndType).
@ -677,6 +680,7 @@ func (s *Service) ApiUpdateZoneMomentBusinessValidate(ctx *gin.Context, req *zon
QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist().
EnsureIsThisRole(consts.Streamer).
EnsureVideoIsUnique(req.ZoneMoment.MediaComp).
EnsureMediaIsSuccessfullyUploaded(req.ZoneMoment.MediaComp).
EnsureZoneMomentImagesEnoughForEncryption(req.ZoneMoment.GetMType(), req.ZoneMoment.MediaComp, mediaVisibleRange).
Validate().

View File

@ -726,6 +726,17 @@ func (l *AuthBusinessValidator) EnsureZoneThirdPartnerIsNotZoneCreater(fun func(
return l
}
func (l *AuthBusinessValidator) EnsureVideoIsUnique(media *dbstruct.MediaComponent) *AuthBusinessValidator {
l.oplist = append(l.oplist, func() {
if len(media.GetVideoIds()) > 0 {
if len(media.GetVideoIds()) > 1 {
l.ec = errcode.ErrCodeMediaVideoMustBeUnique
}
}
})
return l
}
func (l *AuthBusinessValidator) EnsureStreamerAuthApprovalBasicCreated(fun func(*gin.Context, int64) (*dbstruct.StreamerAuthApprovalBasic, error), mid int64) *AuthBusinessValidator {
l.oplist = append(l.oplist, func() {
streamerauthapprovalbasic, err := fun(l.ctx, mid)