This commit is contained in:
aozhiwei 2024-03-30 10:28:01 +08:00
parent 8bebbdc293
commit 3e978f6c80
2 changed files with 62 additions and 2 deletions

View File

@ -178,11 +178,70 @@ func (this *friendMgr) AsyncGetApplyList(lastIdx int64, accountId string, cb fun
}
func (this *friendMgr) AsyncAddFriend(senderId string, targetId string, cb func(int32, string)) {
}
func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb func(int32, string)) {
if senderId == targetId {
cb(1, "")
return
}
queryCb := func () {
if this.IsFriend(senderId, targetId) {
f5.GetJsStyleDb().Update(
constant.FRIEND_DB,
"t_friend_apply",
[][]string{
{"status", "1"},
},
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", "0"},
},
func (err error, lastInsertId int64, rowsAffected int64) {
})
cb(0, "")
return
} else {
f5.GetJsStyleDb().Upsert(
constant.FRIEND_DB,
"t_friend_relationship",
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", "0"},
},
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", "0"},
},
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", "0"},
},
func (err error, lastInsertId int64, rowsAffected int64) {
})
}
}
f5.GetJsStyleDb().OrmSelectOne(
constant.FRIEND_DB,
"t_friend_apply",
[][]string{
{"sender_id", senderId},
{"target_id", targetId},
{"status", "0"},
},
func (err error, ds *f5.DataSet) {
if err != nil {
cb(1, "")
return
}
queryCb()
})
}
func (this *friendMgr) AsyncRejectApply(senderId string, targetId string, cb func(int32, string)) {

View File

@ -172,7 +172,8 @@ func (this *player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendReques
this.GetAccountId(),
msg.GetTargetAccountId(),
func (errCode int32, errMsg string) {
this.SendMsg(rspMsg.Err(errCode, errMsg))
return
})
}