1
This commit is contained in:
parent
89c788c19b
commit
f80a0c21c9
@ -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))
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user