From 2529312a1d968e2964aac346c26193586f96ae38 Mon Sep 17 00:00:00 2001 From: away <1819625428@qq.com> Date: Thu, 27 May 2021 19:17:45 +0800 Subject: [PATCH] friend relationship insert --->replace --- src/rpc/friend/friend/add_friend.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rpc/friend/friend/add_friend.go b/src/rpc/friend/friend/add_friend.go index f0b3a2bce..b71f07123 100644 --- a/src/rpc/friend/friend/add_friend.go +++ b/src/rpc/friend/friend/add_friend.go @@ -11,7 +11,6 @@ import ( "Open_IM/src/push/logic" "Open_IM/src/utils" "context" - "fmt" ) func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.CommonResp, error) { @@ -22,10 +21,10 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil } - //Establish a relationship in the friend request table - err = im_mysql_model.InsertIntoFriendReq(claims.UID, req.Uid, constant.NotFriendFlag, req.ReqMessage) + //Establish a latest relationship in the friend request table + err = im_mysql_model.ReplaceIntoFriendReq(claims.UID, req.Uid, constant.NotFriendFlag, req.ReqMessage) if err != nil { - log.Error(req.Token, req.OperationID, fmt.Sprintf("err=%s,create friend request ship failed", err.Error())) + log.Error(req.Token, req.OperationID, "err=%s,create friend request ship failed", err.Error()) return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrAddFriend.ErrMsg}, nil } log.Info(req.Token, req.OperationID, "rpc add friend is success return,uid=%s", req.Uid)