From 623f66687e6e9c2ce9cb7a95be112c8644ad9218 Mon Sep 17 00:00:00 2001 From: AndrewZuo01 Date: Thu, 4 Jan 2024 17:46:56 +0800 Subject: [PATCH] update user command notification --- internal/rpc/user/user.go | 18 +++++++++++++++--- pkg/rpcclient/notification/user.go | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 5a79fbc91..d9d36f5d0 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -384,7 +384,11 @@ func (s *userServer) ProcessUserCommandAdd(ctx context.Context, req *pbuser.Proc if err != nil { return nil, err } - + tips := &sdkws.UserCommandAddTips{ + FromUserID: req.UserID, + ToUserID: req.UserID, + } + s.userNotificationSender.UserCommandAddNotification(ctx, tips) return &pbuser.ProcessUserCommandAddResp{}, nil } @@ -395,7 +399,11 @@ func (s *userServer) ProcessUserCommandDelete(ctx context.Context, req *pbuser.P if err != nil { return nil, err } - + tips := &sdkws.UserCommandDeleteTips{ + FromUserID: req.UserID, + ToUserID: req.UserID, + } + s.userNotificationSender.UserCommandDeleteNotification(ctx, tips) return &pbuser.ProcessUserCommandDeleteResp{}, nil } @@ -406,7 +414,11 @@ func (s *userServer) ProcessUserCommandUpdate(ctx context.Context, req *pbuser.P if err != nil { return nil, err } - + tips := &sdkws.UserCommandUpdateTips{ + FromUserID: req.UserID, + ToUserID: req.UserID, + } + s.userNotificationSender.UserCommandUpdateNotification(ctx, tips) return &pbuser.ProcessUserCommandUpdateResp{}, nil } diff --git a/pkg/rpcclient/notification/user.go b/pkg/rpcclient/notification/user.go index 4feebf7b9..eb06566a4 100644 --- a/pkg/rpcclient/notification/user.go +++ b/pkg/rpcclient/notification/user.go @@ -103,3 +103,21 @@ func (u *UserNotificationSender) UserStatusChangeNotification( ) error { return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserStatusChangeNotification, tips) } +func (u *UserNotificationSender) UserCommandUpdateNotification( + ctx context.Context, + tips *sdkws.UserCommandUpdateTips, +) error { + return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserStatusChangeNotification, tips) +} +func (u *UserNotificationSender) UserCommandAddNotification( + ctx context.Context, + tips *sdkws.UserCommandAddTips, +) error { + return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserStatusChangeNotification, tips) +} +func (u *UserNotificationSender) UserCommandDeleteNotification( + ctx context.Context, + tips *sdkws.UserCommandDeleteTips, +) error { + return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserStatusChangeNotification, tips) +}