diff --git a/protocol/userProxy.proto b/protocol/userProxy.proto index 906b1d6d7006f76584df467f9e8e162481cc893d..892be285ade7a4831324f8aaf20c01a332d4f567 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 1a4929b8b1bd4a29bff0ac05ea3420123800c792..91130735195c04c9c7f3c243214c4874fd5c5fcd 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 6098a986c699cb81d1521f1759a00433ee200969..f034683a3a70d79d10a39ba2aeaeca15b28210f7 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 +}