From 20f5a2e3d0108db893a4e360007545268baf461a Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 21 Dec 2022 19:17:24 +0800 Subject: [PATCH] update --- .../logic/domain/friend/friend_service.go | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/internal/logic/domain/friend/friend_service.go b/internal/logic/domain/friend/friend_service.go index 670692b..fe607e6 100644 --- a/internal/logic/domain/friend/friend_service.go +++ b/internal/logic/domain/friend/friend_service.go @@ -108,12 +108,20 @@ func (*friendService) AddFriend(ctx context.Context, userId, friendId int64, rem //TODO::判断是否需要`自动添加好友` masterId, _ := grpclib.GetCtxMasterId(ctx) isAutoAddFriends := svc.SysCfgGet(masterId, "is_auto_add_friends") - utils.FilePutContents("addFriend", utils.SerializeStr(map[string]interface{}{ - "is_auto_add_friends": isAutoAddFriends, - "user": resp.User, - })) - if isAutoAddFriends == "1" && resp.User.IsAutoAddedFriends == 1 { - return FriendService.AgreeAddFriend(ctx, friendId, userId, "系统自动添加") + + //if isAutoAddFriends == "1" && resp.User.IsAutoAddedFriends == 1 { + if isAutoAddFriends == "1" { + respFriend, err := rpc.GetBusinessIntClient().GetUser(ctx, &pb.GetUserReq{UserId: friendId}) + if err != nil { + return err + } + utils.FilePutContents("addFriend", utils.SerializeStr(map[string]interface{}{ + "is_auto_add_friends": isAutoAddFriends, + "user": resp.User, + })) + if respFriend.User.IsAutoAddedFriends == 1 { + return FriendService.AgreeAddFriend(ctx, friendId, userId, "系统自动添加") + } } return nil }