2026-06-04 18:31:06 +08:00

234 lines
6.3 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package hyapp.events.room.v1;
option go_package = "hyapp.local/api/proto/events/room/v1;roomeventsv1";
// EventEnvelope 是 room-service outbox 的统一事件外壳。
// body 保存具体事件消息序列化后的二进制event_type 负责告诉消费者如何解码。
message EventEnvelope {
string event_id = 1;
string room_id = 2;
string event_type = 3;
int64 room_version = 4;
int64 occurred_at_ms = 5;
bytes body = 6;
string app_code = 7;
}
// RoomCreated 表达房间第一次建立成功。
message RoomCreated {
int64 owner_user_id = 1;
int32 seat_count = 3;
string mode = 4;
// room_name/room_avatar/room_description 是创建时确定的展示资料快照,消费者不需要反查 room-service。
string room_name = 5;
string room_avatar = 6;
string room_description = 7;
}
// RoomProfileUpdated 表达房间展示资料或麦位数量变更。
message RoomProfileUpdated {
int64 actor_user_id = 1;
string room_name = 2;
string room_avatar = 3;
string room_description = 4;
int32 seat_count = 5;
string room_background_url = 6;
}
// RoomBackgroundChanged 表达房主切换当前房间背景图。
message RoomBackgroundChanged {
int64 actor_user_id = 1;
int64 background_id = 2;
string room_background_url = 3;
}
// RoomUserJoined 表达用户业务态进房成功。
message RoomEntryVehicleSnapshot {
int64 resource_id = 1;
string resource_code = 2;
string name = 3;
string asset_url = 4;
string preview_url = 5;
string animation_url = 6;
string metadata_json = 7;
string entitlement_id = 8;
int64 expires_at_ms = 9;
}
message RoomUserJoined {
int64 user_id = 1;
string role = 2;
// visible_region_id 是用户进房时所在房间的国家/区域桶,统计服务不能反查 room-service。
int64 visible_region_id = 3;
RoomEntryVehicleSnapshot entry_vehicle = 4;
}
// RoomUserLeft 表达用户离房成功。
message RoomUserLeft {
int64 user_id = 1;
}
// RoomClosed 表达房间生命周期关闭完成。
message RoomClosed {
int64 actor_user_id = 1;
string reason = 2;
}
// RoomMicChanged 表达任意上下麦和换麦位动作。
message RoomMicChanged {
int64 actor_user_id = 1;
int64 target_user_id = 2;
int32 from_seat = 3;
int32 to_seat = 4;
string action = 5;
// mic_session_id 用于把业务麦位事件和 RTC 发流会话绑定,客户端和 webhook 都必须透传。
string mic_session_id = 6;
// publish_state 透出 pending_publish/publishing/idle避免把“占麦”和“已发流”混成一个状态。
string publish_state = 7;
// reason 表示系统触发的下麦原因,例如 publish_timeout。
string reason = 8;
int64 publish_deadline_ms = 9;
int64 publish_event_time_ms = 10;
bool mic_muted = 11;
string seat_status = 12;
}
// RoomMicSeatLocked 表达单个麦位锁定状态变更。
message RoomMicSeatLocked {
int64 actor_user_id = 1;
int32 seat_no = 2;
bool locked = 3;
}
// RoomChatEnabledChanged 表达公屏开关状态变更。
message RoomChatEnabledChanged {
int64 actor_user_id = 1;
bool enabled = 2;
}
// RoomPasswordChanged 表达房间入房密码状态变更,不携带明文或哈希。
message RoomPasswordChanged {
int64 actor_user_id = 1;
bool locked = 2;
// visible_region_id 是房间当前可见区域activity-service 用它把锁房变化投到区域播报群。
int64 visible_region_id = 3;
}
// RoomAdminChanged 表达房间管理员集合变更。
message RoomAdminChanged {
int64 actor_user_id = 1;
int64 target_user_id = 2;
bool enabled = 3;
}
// RoomUserMuted 表达禁言状态变更。
message RoomUserMuted {
int64 actor_user_id = 1;
int64 target_user_id = 2;
bool muted = 3;
}
// RoomUserKicked 表达踢人动作。
message RoomUserKicked {
int64 actor_user_id = 1;
int64 target_user_id = 2;
}
// RoomUserUnbanned 表达解除房间 ban。
message RoomUserUnbanned {
int64 actor_user_id = 1;
int64 target_user_id = 2;
}
// RoomGiftSent 表达送礼成功且已落房间状态。
message RoomGiftSent {
int64 sender_user_id = 1;
int64 target_user_id = 2;
string gift_id = 3;
int32 gift_count = 4;
int64 gift_value = 5;
string billing_receipt_id = 6;
int64 visible_region_id = 7;
string command_id = 8;
string pool_id = 9;
}
// RoomHeatChanged 表达热度变化结果。
message RoomHeatChanged {
int64 delta = 1;
int64 current_heat = 2;
}
// RoomRankChanged 表达本地礼物榜变化结果。
message RoomRankChanged {
int64 user_id = 1;
int64 score = 2;
int64 gift_value = 3;
}
message RoomTreasureRewardGrant {
string reward_role = 1;
int64 user_id = 2;
string reward_item_id = 3;
int64 resource_group_id = 4;
string display_name = 5;
string icon_url = 6;
string grant_id = 7;
string status = 8;
}
// RoomTreasureProgressChanged 表达送礼扣费成功后宝箱有效能量发生变化。
message RoomTreasureProgressChanged {
string box_id = 1;
int32 level = 2;
int64 added_energy = 3;
int64 effective_added_energy = 4;
int64 overflow_energy = 5;
int64 current_progress = 6;
int64 energy_threshold = 7;
string status = 8;
int64 reset_at_ms = 9;
int64 sender_user_id = 10;
string gift_id = 11;
int32 gift_count = 12;
string command_id = 13;
int64 visible_region_id = 14;
}
// RoomTreasureCountdownStarted 表达宝箱满能量后进入倒计时,并作为区域/全局播报的事实源。
message RoomTreasureCountdownStarted {
string box_id = 1;
int32 level = 2;
int64 current_progress = 3;
int64 energy_threshold = 4;
int64 countdown_started_at_ms = 5;
int64 open_at_ms = 6;
string broadcast_scope = 7;
int64 visible_region_id = 8;
int64 top1_user_id = 9;
int64 igniter_user_id = 10;
string command_id = 11;
}
// RoomTreasureOpened 表达宝箱已经打开,在线用户名单按开箱瞬间 Room Cell presence 结算。
message RoomTreasureOpened {
string box_id = 1;
int32 level = 2;
int32 next_level = 3;
int64 opened_at_ms = 4;
int64 reset_at_ms = 5;
int64 top1_user_id = 6;
int64 igniter_user_id = 7;
repeated int64 in_room_user_ids = 8;
repeated RoomTreasureRewardGrant rewards = 9;
}
// RoomTreasureRewardGranted 是客户端展示发奖弹窗和私有通知的最小事实。
message RoomTreasureRewardGranted {
string box_id = 1;
int32 level = 2;
repeated RoomTreasureRewardGrant rewards = 3;
}