This commit is contained in:
aozhiwei 2024-04-07 20:36:02 +08:00
parent e16035737d
commit 37574f5bd8
2 changed files with 33 additions and 0 deletions

View File

@ -322,6 +322,10 @@ func (this *friendMgr) AsyncAddBlack(senderId string, targetId string, cb func(i
cb(0, "")
return
}
if senderId == targetId {
cb(1, "")
return
}
nowTime := f5.GetApp().GetNowSeconds()
f5.GetJsStyleDb().Upsert(
constant.FRIEND_DB,

View File

@ -305,9 +305,38 @@ func (this *player) CMDeleteFriendShip(hdr *f5.MsgHdr, msg *cs.CMDeleteFriendShi
}
func (this *player) CMAddBlacklist(hdr *f5.MsgHdr, msg *cs.CMAddBlacklist) {
rspMsg := new(cs.SMAddBlacklist)
GetFriendMgr().AsyncAddBlack(
this.GetAccountId(),
msg.GetTargetAccountId(),
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(500, "server internal error"))
return
}
this.SendMsg(rspMsg.Err(errCode, errMsg))
})
}
func (this *player) CMRemoveBlacklist(hdr *f5.MsgHdr, msg *cs.CMRemoveBlacklist) {
rspMsg := new(cs.SMRemoveBlacklist)
f5.NewLockAsyncTask(
[][]string{
{constant.MEMBER_LOCK_KEY, this.GetAccountId()},
{constant.MEMBER_LOCK_KEY, msg.GetTargetAccountId()},
},
func (cb *f5.LockAsyncTask) {
GetFriendMgr().AsyncRemoveBlack(
this.GetAccountId(),
msg.GetTargetAccountId(),
func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(500, "server internal error"))
return
}
this.SendMsg(rspMsg)
})
})
}
func (this *player) CMInviteFriendMsg(hdr *f5.MsgHdr, msg *cs.CMInviteFriendMsg) {