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