diff --git a/protocol/userProxy.proto b/protocol/userProxy.proto index f2ec9ea24ec8aec176e24a279239883ab45ef4da..1bea214fd418bbf0e3edf693e7b36e9ecb405c5e 100644 --- a/protocol/userProxy.proto +++ b/protocol/userProxy.proto @@ -487,3 +487,7 @@ message H5GameVoiceMute { /* id == 159 H5游戏打开语音 */ message H5GameVoiceUnMute { } + +/* id == 160 退出房间 */ +message QuitRoom { +} diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index 419c6e7a32ecd6faf4f5bee0dcab7bd9c331aeb7..82886ce3973e76471d0d2ac9e79ef52a45e166cb 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -592,3 +592,29 @@ func SendH5GameUnMute(userId uint64) error { } return nil } + +// 发送退房通知 +func SendQuitRoom(userId uint64) error { + msg := &userProxy.DiamondChange{} + if buffer, err := proto.Marshal(msg); err == nil { + rspUids, err := multicast([]uint64{userId}, MsgTypeQuitRoom, buffer) + // 记录socket + // 有err||uid不在线才入库 + if err != nil || len(rspUids) > 0 { + go func(userId uint64, msg *userProxy.DiamondChange, rspUids []uint64, err error) { + buf, _ := json.Marshal(msg) + AddRpcLog(MsgTypeQuitRoom, userId, string(buf[:]), rspUids, err) + }(userId, msg, rspUids, err) + } + + if err != nil { + mylogrus.MyLog.Errorf("grpc SendQuitRoom send fail") + return err + } else { + mylogrus.MyLog.Info("grpc SendQuitRoom send success") + } + } else { + return err + } + return nil +}