From 66f6ea167680b442d4fefd4a4279a7ffd393cf40 Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Tue, 24 Dec 2024 15:21:57 +0800 Subject: [PATCH] by Robin at 20241224 --- app/mix/service/apiservice.go | 2 +- app/mix/service/notif_builder_handler.go | 35 ++++++++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 76f9c406..7afe5afd 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1474,7 +1474,7 @@ func (s *Service) ApiUpdateStreamer(ctx *gin.Context, req *streamerproto.ApiUpda DefaultNotifBuilderHandler.Handle(ctx)( consts.AudNotifTemp_BioChangeApplied, consts.AudNotifTemp_AutoResponseMessageChangeApplied, consts.AudNotifTemp_CoverChangeApplied, consts.AudNotifTemp_AlbumChangeApplied, - consts.AudNotifTemp_ShortsChangeApplied, consts.AudNotifTemp_StreamerDirectlyUpdated)(req.Streamer) + consts.AudNotifTemp_ShortsChangeApplied, consts.AudNotifTemp_StreamerDirectlyUpdated)(oldStreamer, req.Streamer) return } diff --git a/app/mix/service/notif_builder_handler.go b/app/mix/service/notif_builder_handler.go index 79b1bbd4..f79033e7 100644 --- a/app/mix/service/notif_builder_handler.go +++ b/app/mix/service/notif_builder_handler.go @@ -396,9 +396,10 @@ func (handler *NotifBuilderHandler) handleAudRealNameAuthenticationRejected() { 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()) + oldStreamer := args[0].(*dbstruct.Streamer) + newStreamer := args[1].(*dbstruct.Streamer) + if newStreamer.Bio != nil && oldStreamer.GetBio() != newStreamer.GetBio() { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_BioChangeApplied, newStreamer.GetMid()) } } } @@ -420,9 +421,10 @@ func (handler *NotifBuilderHandler) handleAudBioRejected() { 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()) + oldStreamer := args[0].(*dbstruct.Streamer) + newStreamer := args[1].(*dbstruct.Streamer) + if newStreamer.AutoResponseMessage != nil && oldStreamer.GetAutoResponseMessage() != newStreamer.GetAutoResponseMessage() { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AutoResponseMessageChangeApplied, newStreamer.GetMid()) } } } @@ -444,9 +446,10 @@ func (handler *NotifBuilderHandler) handleAudAutoResponseMessageRejected() { 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()) + oldStreamer := args[0].(*dbstruct.Streamer) + newStreamer := args[1].(*dbstruct.Streamer) + if newStreamer.Cover != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Cover.GetImageIds(), newStreamer.Cover.GetImageIds()) { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_CoverChangeApplied, newStreamer.GetMid()) } } } @@ -468,9 +471,10 @@ func (handler *NotifBuilderHandler) handleAudCoverRejected() { 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()) + oldStreamer := args[0].(*dbstruct.Streamer) + newStreamer := args[1].(*dbstruct.Streamer) + if newStreamer.Album != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Album.GetImageIds(), newStreamer.Album.GetImageIds()) { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_AlbumChangeApplied, newStreamer.GetMid()) } } } @@ -492,9 +496,10 @@ func (handler *NotifBuilderHandler) handleAudAlbumRejected() { 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()) + oldStreamer := args[0].(*dbstruct.Streamer) + newStreamer := args[1].(*dbstruct.Streamer) + if newStreamer.Shorts != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Shorts.GetVideoIds(), newStreamer.Shorts.GetVideoIds()) { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ShortsChangeApplied, newStreamer.GetMid()) } } }