diff --git a/server/imserver_new/common/types.go b/server/imserver_new/common/types.go index be4a2f5c..be0116be 100644 --- a/server/imserver_new/common/types.go +++ b/server/imserver_new/common/types.go @@ -59,7 +59,7 @@ type FriendMgr interface { GetFriendList(string) []string GetBlackList(string) []string AsyncGetApplyList(int64, string, func(int32, string, int64, []string)) - AsyncAddFriend(string, string, func(int32, string)) + AsyncApplyFriend(string, string, func(int32, string)) AsyncAccpetApply(string, string, func(int32, string)) AsyncRejectApply(string, string, func(int32, string)) AsynDeleteFriend(string, string, func(int32, string)) diff --git a/server/imserver_new/friend/friendmgr.go b/server/imserver_new/friend/friendmgr.go index 956cab52..86334e38 100644 --- a/server/imserver_new/friend/friendmgr.go +++ b/server/imserver_new/friend/friendmgr.go @@ -170,7 +170,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, f5.GetDbFilter().Comp( f5.GetDbFilter().GT("idx", q5.ToString(lastIdx)).And(), f5.GetDbFilter().EQ("target_id", accountId).And(), - f5.GetDbFilter().EQ("status", "0"), + f5.GetDbFilter().EQ("status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)), ), "", func (err error, pg *f5.Pagination) { @@ -182,7 +182,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, users := []string{} if pg.Rows.Next() { idx := q5.ToInt64(pg.Rows.GetByName("idx")) - accountId := pg.Rows.GetByName("account_id") + accountId := pg.Rows.GetByName("sender_id") if idx > lastSinceId { lastSinceId = idx } else { @@ -194,7 +194,7 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, }) } -func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(int32, string)) { +func (this *friendMgr) AsyncApplyFriend(senderId string, targetId string, cb func(int32, string)) { if this.IsFriend(senderId, targetId) { cb(0, "") return diff --git a/server/imserver_new/player/player.go b/server/imserver_new/player/player.go index d85f9a41..888582a7 100644 --- a/server/imserver_new/player/player.go +++ b/server/imserver_new/player/player.go @@ -111,8 +111,9 @@ func (this *player) CMListPendingFriendRequest(hdr *f5.MsgHdr, msg *cs.CMListPen for _, accountId := range(accountIds) { 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) @@ -173,7 +174,7 @@ func (this *player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendReques this.SendMsg(rspMsg.Err(2, "Cannot invite oneself")) return } - GetFriendMgr().AsyncAddFriend( + GetFriendMgr().AsyncApplyFriend( this.GetAccountId(), msg.GetTargetAccountId(), func (errCode int32, errMsg string) {