diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 0aeaccef0..ada168ec8 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -2,6 +2,7 @@ package friend import ( "context" + "github.com/OpenIMSDK/Open-IM-Server/internal/common/check" "github.com/OpenIMSDK/Open-IM-Server/internal/common/convert" "github.com/OpenIMSDK/Open-IM-Server/internal/common/notification" @@ -46,7 +47,6 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error { // ok func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) { - resp = &pbfriend.ApplyToAddFriendResp{} if err := tokenverify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } @@ -70,7 +70,7 @@ func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.Apply return nil, err } s.notification.FriendApplicationAddNotification(ctx, req) - return resp, nil + return &pbfriend.ApplyToAddFriendResp{}, nil } // ok diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go index b85a4fb34..c1a2f6b49 100644 --- a/pkg/common/db/controller/friend.go +++ b/pkg/common/db/controller/friend.go @@ -7,6 +7,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/tracelog" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" @@ -72,6 +73,7 @@ func (f *friendDatabase) CheckIn(ctx context.Context, userID1, userID2 string) ( func (f *friendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) { return f.tx.Transaction(func(tx any) error { _, err := f.friendRequest.NewTx(tx).Take(ctx, fromUserID, toUserID) + log.ZError(ctx, "fr error", err) //有db错误 if err != nil && errors.Unwrap(err) != gorm.ErrRecordNotFound { return err