From 2f3874adebdfa5b2e4f8b96dd47b3b20c9a5f50e Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 10 Jul 2023 17:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=B9=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 | 2 ++ rpc/user_center_func.go | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/protocol/userProxy.proto b/protocol/userProxy.proto index 0ec3b2f..85e540e 100644 --- a/protocol/userProxy.proto +++ b/protocol/userProxy.proto @@ -376,6 +376,7 @@ message SheepMatchSuccess { uint64 match_id = 1; User user = 2; User otherUser = 3; + uint64 game_id = 4; } message SheepGamePlayer { @@ -388,6 +389,7 @@ message SheepGamePlayer { message SheepGameResult { uint64 match_id = 1; repeated SheepGamePlayer players = 2; + uint64 game_id = 3; } /* id == 149 cp邀请 */ diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index ea6126f..7603a46 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -224,11 +224,16 @@ func SendGroupChatNotice(fromUserId uint64, userIds []uint64, senderExtId string } // 羊羊匹配成功 -func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string) error { +func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string, gameIds ...uint64) error { + gameId := uint64(0) + if len(gameIds) > 0 { + gameId = gameIds[0] + } msg := &userProxy.SheepMatchSuccess{ MatchId: matchId, User: &userProxy.User{Id: myUserId, Nick: nick1, Avatar: avatar1}, OtherUser: &userProxy.User{Id: otherUserId, Nick: nick2, Avatar: avatar2}, + GameId: gameId, } if buffer, err := proto.Marshal(msg); err == nil { userIds := []uint64{myUserId} @@ -253,7 +258,7 @@ func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, } // 羊羊游戏结果 -func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, avatar1, avatar2 string, isAiMap map[uint64]bool) error { +func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, avatar1, avatar2 string, isAiMap map[uint64]bool, gameIds ...uint64) error { if isAiMap == nil { isAiMap = make(map[uint64]bool) } @@ -270,9 +275,14 @@ func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, for i := range players { players[i].Rank = int32(i) + 1 } + gameId := uint64(0) + if len(gameIds) > 0 { + gameId = gameIds[0] + } msg := &userProxy.SheepGameResult{ MatchId: matchId, Players: players, + GameId: gameId, } if buffer, err := proto.Marshal(msg); err == nil { var userIds []uint64 -- 2.22.0