From f3f88e2edf52eed5b36008399def8c45d9c2a557 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 7 Aug 2023 11:57:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E5=A4=A7=E5=8E=85=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocol/userProxy.proto | 9 +++++++++ rpc/user_center_coder.go | 1 + rpc/user_center_func.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/protocol/userProxy.proto b/protocol/userProxy.proto index 906b1d6..892be28 100644 --- a/protocol/userProxy.proto +++ b/protocol/userProxy.proto @@ -463,4 +463,13 @@ message MicUserData { string micEffect = 14; string headwearIcon = 15; Svip svip = 16; +} + +/* id == 157 游戏大厅匹配成功 */ +message LobbyMatchSuccess { + uint64 game_id = 1; + uint64 mode = 2; + string group_id = 3; + User user = 4; + User otherUser = 5; } \ No newline at end of file diff --git a/rpc/user_center_coder.go b/rpc/user_center_coder.go index 1a4929b..9113073 100644 --- a/rpc/user_center_coder.go +++ b/rpc/user_center_coder.go @@ -67,6 +67,7 @@ const ( MsgTypeCpUpgrade = 150 // cp升级 MsgTypeSvipUpgrade = 151 // svip升级 MsgTypeGroupMicChange = 155 // 麦位变化 + MsgTypeLobbyMatchSuccess = 157 // 羊羊匹配成功 ) const ( diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index 6098a98..f034683 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -444,3 +444,34 @@ func SendSocketMicChange(seqId string, userId uint64, micUserExternalId, txGroup } return nil } + +// 游戏大厅匹配成功 +func SendLobbyMatchSuccess(myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string, gameId uint64, txGroupId string, mode int) error { + msg := &userProxy.LobbyMatchSuccess{ + GameId: gameId, + GroupId: txGroupId, + Mode: uint64(mode), + User: &userProxy.User{Id: myUserId, Nick: nick1, Avatar: avatar1}, + OtherUser: &userProxy.User{Id: otherUserId, Nick: nick2, Avatar: avatar2}, + } + if buffer, err := proto.Marshal(msg); err == nil { + userIds := []uint64{myUserId} + rspUids, err := multicast(userIds, MsgTypeLobbyMatchSuccess, buffer) + + //记录socket,注意闭包问题 + go func(userIds []uint64, msg *userProxy.LobbyMatchSuccess, rspUids []uint64, err error) { + buf, _ := json.Marshal(msg) + AddRpcLogs(MsgTypeLobbyMatchSuccess, userIds, string(buf[:]), rspUids, err) + }(userIds, msg, rspUids, err) + + if err != nil { + mylogrus.MyLog.Errorf("grpc LobbyMatchSuccess send fail") + return err + } else { + mylogrus.MyLog.Info("grpc LobbyMatchSuccess send success") + } + } else { + return err + } + return nil +} -- 2.22.0