69 lines
1.9 KiB
Protocol Buffer
69 lines
1.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package hyapp.im.v1;
|
|
|
|
option go_package = "hyapp/api/proto/im/v1;imv1";
|
|
|
|
// RoomEvent 是 room-service 发给 im-service 的统一房间事件。
|
|
// 这里刻意保持扁平字段,是为了让 room-service 同步广播时不需要再依赖复杂业务结构。
|
|
message RoomEvent {
|
|
string event_id = 1;
|
|
string room_id = 2;
|
|
string event_type = 3;
|
|
int64 actor_user_id = 4;
|
|
int64 target_user_id = 5;
|
|
int32 seat_no = 6;
|
|
int64 gift_value = 7;
|
|
int64 room_heat = 8;
|
|
int64 room_version = 9;
|
|
string text = 10;
|
|
map<string, string> attributes = 11;
|
|
}
|
|
|
|
// PublishRoomEventRequest 要求 im-service 立即把房间系统事件转成消息时间线。
|
|
message PublishRoomEventRequest {
|
|
RoomEvent event = 1;
|
|
}
|
|
|
|
// PublishRoomEventResponse 返回 im-service 分配的房间顺序号。
|
|
message PublishRoomEventResponse {
|
|
bool accepted = 1;
|
|
int64 room_seq = 2;
|
|
string message_id = 3;
|
|
}
|
|
|
|
// PushSystemNoticeRequest 负责向指定用户投递系统通知。
|
|
message PushSystemNoticeRequest {
|
|
string notice_id = 1;
|
|
int64 user_id = 2;
|
|
string title = 3;
|
|
string body = 4;
|
|
map<string, string> attributes = 5;
|
|
}
|
|
|
|
// PushSystemNoticeResponse 返回系统通知是否已入投递链路。
|
|
message PushSystemNoticeResponse {
|
|
bool accepted = 1;
|
|
string message_id = 2;
|
|
}
|
|
|
|
// ForceRoomResyncRequest 让 im-service 主动要求客户端重新拉房间状态。
|
|
message ForceRoomResyncRequest {
|
|
string room_id = 1;
|
|
int64 user_id = 2;
|
|
string reason = 3;
|
|
}
|
|
|
|
// ForceRoomResyncResponse 返回触发结果。
|
|
message ForceRoomResyncResponse {
|
|
bool accepted = 1;
|
|
}
|
|
|
|
// RoomBridgeService 只承载 room-service 与 im-service 的内部桥接能力。
|
|
service RoomBridgeService {
|
|
rpc PublishRoomEvent(PublishRoomEventRequest) returns (PublishRoomEventResponse);
|
|
rpc PushSystemNotice(PushSystemNoticeRequest) returns (PushSystemNoticeResponse);
|
|
rpc ForceRoomResync(ForceRoomResyncRequest) returns (ForceRoomResyncResponse);
|
|
}
|
|
|