From 7acea617caed88a28fe31e371f5937d3acfd8350 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 7 Apr 2024 17:58:41 +0800 Subject: [PATCH] 1 --- server/imserver_new/friend/friendmgr.go | 6 +++--- server/imserver_new/player/player.go | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/imserver_new/friend/friendmgr.go b/server/imserver_new/friend/friendmgr.go index e28dabc4..64b0eeb2 100644 --- a/server/imserver_new/friend/friendmgr.go +++ b/server/imserver_new/friend/friendmgr.go @@ -373,7 +373,7 @@ func (this *friendMgr) AsyncRemoveBlack(senderId string, targetId string, cb fun func (this *friendMgr) addFriendShip(accountId1 string, accountId2 string, addTime int32) { { friends := this.getFriends(accountId1) - if friends != nil { + if friends == nil { this.friendHash[accountId1] = make(map[string]int32) friends = this.getFriends(accountId1) } @@ -381,7 +381,7 @@ func (this *friendMgr) addFriendShip(accountId1 string, accountId2 string, addTi } { friends := this.getFriends(accountId2) - if friends != nil { + if friends == nil { this.friendHash[accountId2] = make(map[string]int32) friends = this.getFriends(accountId2) } @@ -407,7 +407,7 @@ func (this *friendMgr) removeFriendShip(accountId1 string, accountId2 string) { func (this *friendMgr) addBlackList(accountId string, blockId string, addTime int32) { { blacks := this.getBlacks(accountId) - if blacks != nil { + if blacks == nil { this.blackHash[accountId] = make(map[string]int32) blacks = this.getBlacks(accountId) } diff --git a/server/imserver_new/player/player.go b/server/imserver_new/player/player.go index a3abaa3b..af1bab48 100644 --- a/server/imserver_new/player/player.go +++ b/server/imserver_new/player/player.go @@ -135,8 +135,9 @@ func (this *player) CMListFriend(hdr *f5.MsgHdr, msg *cs.CMListFriend) { for _, accountId := range(friendList) { userProfile := GetCacheMgr().GetUserProfile(accountId) if userProfile != nil { - ele := q5.NewSliceElement(&rspMsg.Users) - userProfile.FillMFUser(*ele) + ele := new(cs.MFUser) + q5.AppendSlice(&rspMsg.Users, ele) + userProfile.FillMFUser(ele) } } this.SendMsg(rspMsg) @@ -217,8 +218,8 @@ func (this *player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriend constant.FRIEND_DB, "t_friend_apply", [][]string{ - {"sender_id", this.GetAccountId()}, - {"target_id", msg.GetTargetAccountId()}, + {"sender_id", msg.GetTargetAccountId()}, + {"target_id", this.GetAccountId()}, {"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)}, }, func (err error, ds *f5.DataSet) {