diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 00e4dc5c..ae849677 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -397,6 +397,8 @@ func (s *Service) ApiUpdateAccount(ctx *gin.Context, req *accountproto.ApiUpdate } // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_AvatarChangeApplied, consts.AudNotifTemp_NameChangeApplied)(req.Account) return } @@ -1082,7 +1084,8 @@ func (s *Service) ApiCreateStreamerAuthApprovalBasic(ctx *gin.Context, req *stre return } - ctx.Set("notif_template_id", consts.AudNotifTemp_StreamerBasicInfoApplied) + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_StreamerBasicInfoApplied)(req.StreamerAuthApprovalBasic) return } @@ -1216,6 +1219,9 @@ func (s *Service) ApiCreateStreamerAuthApprovalDetails(ctx *gin.Context, req *st s.CreateStreamerAuthApprovalDetailsTextAudit(ctx, req.StreamerAuthApprovalDetails) s.CreateStreamerAuthApprovalDetailsVideoModeration(ctx, req.StreamerAuthApprovalDetails) + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_StreamerDetailsApplied)(req.StreamerAuthApprovalDetails) + return } @@ -1473,6 +1479,12 @@ func (s *Service) ApiUpdateStreamer(ctx *gin.Context, req *streamerproto.ApiUpda return } + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_BioChangeApplied, consts.AudNotifTemp_AutoResponseMessageChangeApplied, + consts.AudNotifTemp_CoverChangeApplied, consts.AudNotifTemp_AlbumChangeApplied, + consts.AudNotifTemp_ShortsChangeApplied, consts.AudNotifTemp_StreamerDirectlyUpdated)(req.Streamer) + return } @@ -2893,7 +2905,8 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) ( } }() - DefaultNotifBuilderHandler.Handle(ctx)(consts.SysNotifTemp_ZoneCreated)(req.Zone) + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_ProfileChangeApplied, consts.SysNotifTemp_ZoneCreated)(req.Zone) return } @@ -2969,7 +2982,8 @@ func (s *Service) ApiUpdateZone(ctx *gin.Context, req *zoneproto.ApiUpdateReq) ( } // 发送通知 - DefaultNotifBuilderHandler.Handle(ctx)(consts.SysNotifTemp_ZoneVasUpdated)(req) + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_ProfileChangeApplied, consts.SysNotifTemp_ZoneVasUpdated)(req) return } diff --git a/app/mix/service/notif_builder_handler.go b/app/mix/service/notif_builder_handler.go index e7192cbe..ee7789f1 100644 --- a/app/mix/service/notif_builder_handler.go +++ b/app/mix/service/notif_builder_handler.go @@ -181,3 +181,127 @@ func (handler *NotifBuilderHandler) handleSysMembershipPurchased() { DefaultService.utilWriteNotifInfo(ctx, consts.SysNotifTemp_MembershipPurchased, mid) } } + +func (handler *NotifBuilderHandler) handleAudAvatarChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_AvatarChangeApplied] = func(ctx *gin.Context, args ...any) { + account := args[0].(*dbstruct.Account) + if account.Avatar != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AvatarChangeApplied, account.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudNameChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_NameChangeApplied] = func(ctx *gin.Context, args ...any) { + account := args[0].(*dbstruct.Account) + if account.Name != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_NameChangeApplied, account.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerBasicInfoApplied() { + handler.handlerMap[consts.AudNotifTemp_StreamerBasicInfoApplied] = func(ctx *gin.Context, args ...any) { + streamerBasic := args[0].(*dbstruct.StreamerAuthApprovalBasic) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerBasicInfoApplied, streamerBasic.GetMid()) + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerBasicInfoPassed() { + handler.handlerMap[consts.AudNotifTemp_StreamerBasicInfoPassed] = func(ctx *gin.Context, args ...any) { + mids := args[0].([]int64) + for _, mid := range mids { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerBasicInfoPassed, mid) + } + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerBasicInfoRejected() { + handler.handlerMap[consts.AudNotifTemp_StreamerBasicInfoRejected] = func(ctx *gin.Context, args ...any) { + mids := args[0].([]int64) + remarks := args[1].(string) + for _, mid := range mids { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerBasicInfoRejected, mid, remarks) + } + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerDetailsApplied() { + handler.handlerMap[consts.AudNotifTemp_StreamerDetailsApplied] = func(ctx *gin.Context, args ...any) { + streamerDetails := args[0].(*dbstruct.StreamerAuthApprovalDetails) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerDetailsApplied, streamerDetails.GetMid()) + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerDetailsPassed() { + handler.handlerMap[consts.AudNotifTemp_StreamerDetailsPassed] = func(ctx *gin.Context, args ...any) { + mids := args[0].([]int64) + for _, mid := range mids { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerDetailsPassed, mid) + } + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerDetailsRejected() { + handler.handlerMap[consts.AudNotifTemp_StreamerDetailsRejected] = func(ctx *gin.Context, args ...any) { + mids := args[0].([]int64) + remarks := args[1].(string) + for _, mid := range mids { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerDetailsRejected, mid, remarks) + } + } +} + +func (handler *NotifBuilderHandler) handleAudBioChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_BioChangeApplied] = func(ctx *gin.Context, args ...any) { + streamer := args[0].(*dbstruct.Streamer) + if streamer.Bio != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_BioChangeApplied, streamer.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudAutoResponseMessageChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_AutoResponseMessageChangeApplied] = func(ctx *gin.Context, args ...any) { + streamer := args[0].(*dbstruct.Streamer) + if streamer.AutoResponseMessage != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AutoResponseMessageChangeApplied, streamer.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudCoverChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_CoverChangeApplied] = func(ctx *gin.Context, args ...any) { + streamer := args[0].(*dbstruct.Streamer) + if streamer.Cover != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_CoverChangeApplied, streamer.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudAlbumChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_AlbumChangeApplied] = func(ctx *gin.Context, args ...any) { + streamer := args[0].(*dbstruct.Streamer) + if streamer.Album != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AlbumChangeApplied, streamer.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudShortsChangeApplied() { + handler.handlerMap[consts.AudNotifTemp_ShortsChangeApplied] = func(ctx *gin.Context, args ...any) { + streamer := args[0].(*dbstruct.Streamer) + if streamer.Shorts != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ShortsChangeApplied, streamer.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudStreamerDirectlyUpdated() { + handler.handlerMap[consts.AudNotifTemp_StreamerDirectlyUpdated] = func(ctx *gin.Context, args ...any) { + streamer := args[0].(*dbstruct.Streamer) + if streamer.Bio == nil && streamer.AutoResponseMessage == nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_StreamerDirectlyUpdated, streamer.GetMid()) + } + } +} diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 304ceb8b..fbe58c12 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -269,6 +269,7 @@ func (s *Service) Init(c any) (err error) { _DefaultEmail = logic.NewEmail(store) _DefaultNotification = logic.NewNotification(store) _DefaultRavenIQTest = logic.NewRavenIQTest(store) + _DefaultRavenIQTestVisit = logic.NewRavenIQTestVisit(store) _DefaultHistory = logic.NewHistory(store) _DefaultRavenIQTestVisit = logic.NewRavenIQTestVisit(store) _DefaultNotifBcstVers = logic.NewNotifBcstVers(store) @@ -2073,6 +2074,10 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvFail return } + + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_StreamerBasicInfoRejected)(mids, util.DerefString(req.Remarks)) return } @@ -2122,6 +2127,9 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre ec = errcode.ErrCodeAccountSrvFail return } + + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_StreamerBasicInfoPassed)(midList) } return @@ -2254,6 +2262,11 @@ func (s *Service) OpApproveStreamerAuthApprovalDetails(ctx *gin.Context, req *st ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvFail return } + + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_StreamerDetailsRejected)(mids, util.DerefString(req.Remarks)) + return } @@ -2354,7 +2367,8 @@ func (s *Service) OpApproveStreamerAuthApprovalDetails(ctx *gin.Context, req *st } // 发送通知 - DefaultNotifBuilderHandler.Handle(ctx)(consts.SysNotifTemp_StreamerAuthApprovalPassed)(mids) + DefaultNotifBuilderHandler.Handle(ctx)( + consts.AudNotifTemp_StreamerDetailsPassed, consts.SysNotifTemp_StreamerAuthApprovalPassed)(mids) } return