This commit is contained in:
aozhiwei 2024-04-07 17:48:29 +08:00
parent 29831bb1f2
commit 1a63fe4a4a
2 changed files with 10 additions and 19 deletions

View File

@ -234,7 +234,7 @@ func (this *friendMgr) AsyncAcceptApply(senderId string, targetId string, cb fun
return return
} }
accountId1, accountId2 := this.sortAccounts(senderId, targetId) accountId1, accountId2 := this.sortAccounts(senderId, targetId)
queryCb := func () { func () {
if this.IsFriend(senderId, targetId) { if this.IsFriend(senderId, targetId) {
this.asyncSetApplyStatus(senderId, targetId, 1) this.asyncSetApplyStatus(senderId, targetId, 1)
cb(0, "") cb(0, "")
@ -265,27 +265,14 @@ func (this *friendMgr) AsyncAcceptApply(senderId string, targetId string, cb fun
cb(1, "") cb(1, "")
return return
} }
this.asyncSetApplyStatus(senderId, targetId, 1) this.asyncSetApplyStatus(senderId,
targetId,
constant.FRIEND_APPLY_STATUS_ACCEPT)
this.addFriendShip(accountId1, accountId2, int32(nowTime)) this.addFriendShip(accountId1, accountId2, int32(nowTime))
cb(0, "") cb(0, "")
}) })
} }
} }()
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)) { func (this *friendMgr) AsyncRejectApply(senderId string, targetId string, cb func(int32, string)) {

View File

@ -205,7 +205,11 @@ func (this *player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriend
this.GetAccountId(), this.GetAccountId(),
msg.GetTargetAccountId(), msg.GetTargetAccountId(),
func (errCode int32, errMsg string) { func (errCode int32, errMsg string) {
if errCode != 0 {
this.SendMsg(rspMsg.Err(500, "server internal error"))
return
}
this.SendMsg(rspMsg)
}) })
}) })
} }