diff --git a/server/imserver_new/friend/friendmgr.go b/server/imserver_new/friend/friendmgr.go index 2e8f60d0..e28dabc4 100644 --- a/server/imserver_new/friend/friendmgr.go +++ b/server/imserver_new/friend/friendmgr.go @@ -234,7 +234,7 @@ func (this *friendMgr) AsyncAcceptApply(senderId string, targetId string, cb fun return } accountId1, accountId2 := this.sortAccounts(senderId, targetId) - queryCb := func () { + func () { if this.IsFriend(senderId, targetId) { this.asyncSetApplyStatus(senderId, targetId, 1) cb(0, "") @@ -265,27 +265,14 @@ func (this *friendMgr) AsyncAcceptApply(senderId string, targetId string, cb fun cb(1, "") return } - this.asyncSetApplyStatus(senderId, targetId, 1) + this.asyncSetApplyStatus(senderId, + targetId, + constant.FRIEND_APPLY_STATUS_ACCEPT) this.addFriendShip(accountId1, accountId2, int32(nowTime)) cb(0, "") }) } - } - f5.GetJsStyleDb().OrmSelectOne( - constant.FRIEND_DB, - "t_friend_apply", - [][]string{ - {"sender_id", senderId}, - {"target_id", targetId}, - {"status", "0"}, - }, - func (err error, ds *f5.DataSet) { - if err != nil { - cb(1, "") - return - } - queryCb() - }) + }() } func (this *friendMgr) AsyncRejectApply(senderId string, targetId string, cb func(int32, string)) { diff --git a/server/imserver_new/player/player.go b/server/imserver_new/player/player.go index 48376a81..a3abaa3b 100644 --- a/server/imserver_new/player/player.go +++ b/server/imserver_new/player/player.go @@ -205,7 +205,11 @@ func (this *player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriend this.GetAccountId(), msg.GetTargetAccountId(), func (errCode int32, errMsg string) { - + if errCode != 0 { + this.SendMsg(rspMsg.Err(500, "server internal error")) + return + } + this.SendMsg(rspMsg) }) }) }