This commit is contained in:
aozhiwei 2024-04-07 16:30:20 +08:00
parent d53188ef18
commit 6753cd82fe
3 changed files with 13 additions and 3 deletions

View File

@ -43,6 +43,13 @@ const (
CACHE_LOCK_KEY = "cache:"
)
const (
FRIEND_APPLY_STATUS_NONE = 0
FRIEND_APPLY_STATUS_ACCEPT = 1
FRIEND_APPLY_STATUS_REJECT = 2
FRIEND_APPLY_STATUS_IGNORE = 3
)
const (
GUILD_APPLY_STATUS_NONE = 0
GUILD_APPLY_STATUS_ACCEPT = 1

View File

@ -208,13 +208,13 @@ func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(
{"target_id", targetId},
},
[][]string{
{"status", q5.ToString(0)},
{"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)},
{"last_apply_time", q5.ToString(nowTime)},
},
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", q5.ToString(0)},
{"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)},
{"last_apply_time", q5.ToString(nowTime)},
{"createtime", q5.ToString(nowTime)},
{"modifytime", q5.ToString(nowTime)},
@ -224,7 +224,6 @@ func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(
cb(1, "")
return
}
this.asyncSetApplyStatus(senderId, targetId, 1)
cb(0, "")
})
}

View File

@ -169,6 +169,10 @@ func (this *player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendReques
this.SendMsg(rspMsg)
return
}
if this.GetAccountId() == msg.GetTargetAccountId() {
this.SendMsg(rspMsg.Err(2, "Cannot invite oneself"))
return
}
GetFriendMgr().AsyncAddFriend(
this.GetAccountId(),
msg.GetTargetAccountId(),