diff --git a/protocol/userProxy.proto b/protocol/userProxy.proto index 0ec3b2f44abb74aa2da138baa32180d8955c5293..85e540e6ec8652e7067edd5db1d654e1eef13289 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 ea6126f528e17939d5b53ce9942ecdd5dc8487f3..7603a469edf93465fe3b3288e57eaa1127f70ad5 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