From e7975c9ef56f3d8e550b7c4e8eebcf3d04380c0c Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 19 Apr 2023 10:48:59 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=85=BC=E5=AE=B9=E9=9D=9E0?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/user_center_func.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index bddf1da..2f5f07b 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -226,7 +226,13 @@ func SendSheepMatchSuccess(matchId, userId1, userId2 uint64, nick1, nick2, avata UserId2: &userProxy.User{Id: userId2, Nick: nick2, Avatar: avatar2}, } if buffer, err := proto.Marshal(msg); err == nil { - userIds := []uint64{userId1, userId2} + var userIds []uint64 + if userId1 > 0 { + userIds = append(userIds, userId1) + } + if userId2 > 0 { + userIds = append(userIds, userId2) + } rspUids, err := multicast(userIds, MsgTypeSheepGameMatchSuccess, buffer) //记录socket,注意闭包问题 @@ -261,7 +267,13 @@ func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, Players: players, } if buffer, err := proto.Marshal(msg); err == nil { - userIds := []uint64{userId1, userId2} + var userIds []uint64 + if userId1 > 0 { + userIds = append(userIds, userId1) + } + if userId2 > 0 { + userIds = append(userIds, userId2) + } rspUids, err := multicast(userIds, MsgTypeSheepGameResult, buffer) //记录socket,注意闭包问题 -- 2.22.0