From 8af6b0ae1f10fb0e607cea2ab5d72e96c6ac3a25 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Mon, 11 Nov 2024 15:38:06 +0800 Subject: [PATCH] by Robin at 20241111 --- app/mix/service/apiservice.go | 9 +++++++++ app/mix/service/notif_builder_handler.go | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 8e3cbe5a..eb967bfe 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2366,6 +2366,9 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe return } + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_MomentCreated)(req.Moment) + return } @@ -3204,6 +3207,9 @@ func (s *Service) ApiCreateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api } } + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_ZoneMomentCreated)(req.ZoneMoment) + return } @@ -3308,6 +3314,9 @@ func (s *Service) ApiUpdateZoneMoment(ctx *gin.Context, req *zonemomentproto.Api } } + // 发送通知 + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_ZoneMomentReedited)(req.ZoneMoment) + return } diff --git a/app/mix/service/notif_builder_handler.go b/app/mix/service/notif_builder_handler.go index ee7789f1..12af48fb 100644 --- a/app/mix/service/notif_builder_handler.go +++ b/app/mix/service/notif_builder_handler.go @@ -305,3 +305,24 @@ func (handler *NotifBuilderHandler) handleAudStreamerDirectlyUpdated() { } } } + +func (handler *NotifBuilderHandler) handleAudMomentCreated() { + handler.handlerMap[consts.AudNotifTemp_MomentCreated] = func(ctx *gin.Context, args ...any) { + moment := args[0].(*dbstruct.Moment) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_MomentCreated, moment.GetMid()) + } +} + +func (handler *NotifBuilderHandler) handleAudZoneMomentCreated() { + handler.handlerMap[consts.AudNotifTemp_ZoneMomentCreated] = func(ctx *gin.Context, args ...any) { + zoneMoment := args[0].(*dbstruct.ZoneMoment) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentCreated, zoneMoment.GetMid()) + } +} + +func (handler *NotifBuilderHandler) handleAudZoneMomentReedited() { + handler.handlerMap[consts.AudNotifTemp_ZoneMomentReedited] = func(ctx *gin.Context, args ...any) { + zoneMoment := args[0].(*dbstruct.ZoneMoment) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_ZoneMomentReedited, zoneMoment.GetMid()) + } +}