Commit e7975c9e authored by hujiebin's avatar hujiebin

feat:兼容非0情况

parent 100ebb9d
...@@ -226,7 +226,13 @@ func SendSheepMatchSuccess(matchId, userId1, userId2 uint64, nick1, nick2, avata ...@@ -226,7 +226,13 @@ func SendSheepMatchSuccess(matchId, userId1, userId2 uint64, nick1, nick2, avata
UserId2: &userProxy.User{Id: userId2, Nick: nick2, Avatar: avatar2}, UserId2: &userProxy.User{Id: userId2, Nick: nick2, Avatar: avatar2},
} }
if buffer, err := proto.Marshal(msg); err == nil { 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) rspUids, err := multicast(userIds, MsgTypeSheepGameMatchSuccess, buffer)
//记录socket,注意闭包问题 //记录socket,注意闭包问题
...@@ -261,7 +267,13 @@ func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, ...@@ -261,7 +267,13 @@ func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2,
Players: players, Players: players,
} }
if buffer, err := proto.Marshal(msg); err == nil { 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) rspUids, err := multicast(userIds, MsgTypeSheepGameResult, buffer)
//记录socket,注意闭包问题 //记录socket,注意闭包问题
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment