diff --git a/server/imserver_new/common/types.go b/server/imserver_new/common/types.go index be0116be..79d0452a 100644 --- a/server/imserver_new/common/types.go +++ b/server/imserver_new/common/types.go @@ -60,7 +60,7 @@ type FriendMgr interface { GetBlackList(string) []string AsyncGetApplyList(int64, string, func(int32, string, int64, []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)) AsynDeleteFriend(string, string, func(int32, string)) AsyncAddBlack(string, string, func(int32, string)) diff --git a/server/imserver_new/friend/friendmgr.go b/server/imserver_new/friend/friendmgr.go index 86334e38..2e8f60d0 100644 --- a/server/imserver_new/friend/friendmgr.go +++ b/server/imserver_new/friend/friendmgr.go @@ -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 { cb(1, "") return diff --git a/server/imserver_new/player/player.go b/server/imserver_new/player/player.go index 2ada8ac1..48376a81 100644 --- a/server/imserver_new/player/player.go +++ b/server/imserver_new/player/player.go @@ -6,6 +6,7 @@ import ( "f5" "github.com/golang/protobuf/proto" "main/common" + "main/constant" . "main/global" ) @@ -193,6 +194,41 @@ func (this *player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriend this.SendMsg(rspMsg) 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) {