Commit 88fb3302 authored by chenweijian's avatar chenweijian

退房

parent 776eed0d
......@@ -487,3 +487,7 @@ message H5GameVoiceMute {
/* id == 159 H5游戏打开语音 */
message H5GameVoiceUnMute {
}
/* id == 160 退出房间 */
message QuitRoom {
}
......@@ -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
}
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