This commit is contained in:
aozhiwei 2024-03-23 10:35:56 +08:00
parent 89c788c19b
commit f80a0c21c9
3 changed files with 33 additions and 0 deletions

View File

@ -57,6 +57,7 @@ type PlayerMgr interface {
type FriendMgr interface {
IsFriend(string, string) bool
GetFriendList(string) []string
GetBlackList(string) []string
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
}

View File

@ -69,6 +69,20 @@ func (this *FriendMgr) GetFriendList(accountId string) []string {
return friendList
}
func (this *FriendMgr) GetBlackList(accountId string) []string {
blackList := []string{}
/*
this.TraverseFriend(
accountId,
func (friendId string, addTime int32) bool {
ele := q5.NewSliceElement(&friendList)
*ele = friendId
return true
})
*/
return blackList
}
func (this *FriendMgr) getFriends(accountId string) *map[string]int32 {
if friends, ok := this.friendHash[accountId]; ok {
return friends

View File

@ -141,6 +141,24 @@ func (this *player) CMListFriend(hdr *f5.MsgHdr, msg *cs.CMListFriend) {
}
func (this *player) CMBlacklist(hdr *f5.MsgHdr, msg *cs.CMBlacklist) {
blackList := GetFriendMgr().GetBlackList(this.GetAccountId())
GetCacheMgr().AsyncGetUsers(
blackList,
func (errCode int32, errMsg string) {
rspMsg := new(cs.SMBlacklist)
if errCode != 0 {
this.SendMsg(rspMsg.Err(1, "internal server error"))
return
}
for _, accountId := range(blackList) {
userProfile := GetCacheMgr().GetUserProfile(accountId)
if userProfile != nil {
ele := q5.NewSliceElement(&rspMsg.Users)
userProfile.FillMFUser(*ele)
}
}
this.SendMsg(rspMsg)
})
}
func (this *player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendRequest) {