1
This commit is contained in:
parent
d63f9fdca3
commit
29831bb1f2
@ -60,7 +60,7 @@ type FriendMgr interface {
|
|||||||
GetBlackList(string) []string
|
GetBlackList(string) []string
|
||||||
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
|
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
|
||||||
AsyncApplyFriend(string, string, func(int32, string))
|
AsyncApplyFriend(string, string, func(int32, string))
|
||||||
AsyncAccpetApply(string, string, func(int32, string))
|
AsyncAcceptApply(string, string, func(int32, string))
|
||||||
AsyncRejectApply(string, string, func(int32, string))
|
AsyncRejectApply(string, string, func(int32, string))
|
||||||
AsynDeleteFriend(string, string, func(int32, string))
|
AsynDeleteFriend(string, string, func(int32, string))
|
||||||
AsyncAddBlack(string, string, func(int32, string))
|
AsyncAddBlack(string, string, func(int32, string))
|
||||||
|
@ -228,7 +228,7 @@ func (this *friendMgr) AsyncApplyFriend(senderId string, targetId string, cb fun
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *friendMgr) AsyncAccpetApply(senderId string, targetId string, cb func(int32, string)) {
|
func (this *friendMgr) AsyncAcceptApply(senderId string, targetId string, cb func(int32, string)) {
|
||||||
if senderId == targetId {
|
if senderId == targetId {
|
||||||
cb(1, "")
|
cb(1, "")
|
||||||
return
|
return
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"f5"
|
"f5"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"main/common"
|
"main/common"
|
||||||
|
"main/constant"
|
||||||
. "main/global"
|
. "main/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -193,6 +194,41 @@ func (this *player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriend
|
|||||||
this.SendMsg(rspMsg)
|
this.SendMsg(rspMsg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
doFunc := func () {
|
||||||
|
f5.NewLockAsyncTask(
|
||||||
|
[][]string{
|
||||||
|
{constant.MEMBER_LOCK_KEY, this.GetAccountId()},
|
||||||
|
{constant.MEMBER_LOCK_KEY, msg.GetTargetAccountId()},
|
||||||
|
},
|
||||||
|
func (cb *f5.LockAsyncTask) {
|
||||||
|
GetFriendMgr().AsyncAcceptApply(
|
||||||
|
this.GetAccountId(),
|
||||||
|
msg.GetTargetAccountId(),
|
||||||
|
func (errCode int32, errMsg string) {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
f5.GetJsStyleDb().OrmSelectOne(
|
||||||
|
constant.FRIEND_DB,
|
||||||
|
"t_friend_apply",
|
||||||
|
[][]string{
|
||||||
|
{"sender_id", this.GetAccountId()},
|
||||||
|
{"target_id", msg.GetTargetAccountId()},
|
||||||
|
{"status", q5.ToString(constant.FRIEND_APPLY_STATUS_NONE)},
|
||||||
|
},
|
||||||
|
func (err error, ds *f5.DataSet) {
|
||||||
|
if err != nil {
|
||||||
|
this.SendMsg(rspMsg.Err(500, "server internal error"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ds.Next() {
|
||||||
|
doFunc()
|
||||||
|
} else {
|
||||||
|
this.SendMsg(rspMsg.Err(500, "server internal error"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) CMRejectFriendRequest(hdr *f5.MsgHdr, msg *cs.CMRejectFriendRequest) {
|
func (this *player) CMRejectFriendRequest(hdr *f5.MsgHdr, msg *cs.CMRejectFriendRequest) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user