websocket.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. syntax = "proto3";
  2. package api.websocket;
  3. //import "google/api/annotations.proto";
  4. //import "google/protobuf/struct.proto";
  5. import "google/protobuf/empty.proto";
  6. option go_package = "git.ikuban.com/server/pw-protobuf/api/websocket;websocket";
  7. option java_multiple_files = true;
  8. option java_package = "api.websocket";
  9. service Websocket {
  10. // 查询在线人数
  11. rpc FindOnlinePerson (google.protobuf.Empty) returns (FindOnlinePersonReply);
  12. // 查询在线人数
  13. rpc FindOnlinePersonAll (google.protobuf.Empty) returns (FindOnlinePersonReply);
  14. // 查询在线人数
  15. rpc FindOnlineCanMatchingPerson (google.protobuf.Empty) returns (FindOnlineCanMatchingPersonReply);
  16. // 发送消息
  17. rpc SendMsg (SendMsgRequest) returns (SendMsgReply){};
  18. // 更新工作状态
  19. rpc UpdateWorkingStatus (UpdateWorkingStatusRequest) returns (google.protobuf.Empty){};
  20. // 更新权重
  21. rpc UpdateWeight (UpdateWeightRequest) returns (google.protobuf.Empty){};
  22. // 更新每日被匹配数
  23. rpc UpdateTodayMatchedNum (UpdateTodayMatchedNumRequest) returns (google.protobuf.Empty){};
  24. // 检查是否在线
  25. rpc CheckIsOnline (CheckIsOnlineRequest) returns (CheckIsOnlineReply){};
  26. // 检查是否在线
  27. rpc CheckIsOnlineByIDs (CheckIsOnlineByIDsParam) returns (CheckIsOnlineByIDsParam){};
  28. // 查询在线多少人
  29. rpc FindOnlinePersonNum (google.protobuf.Empty) returns (OnlinePersonReply);
  30. // 定时检查在线超过一小时的用户并将其下线
  31. rpc CronCheckConnectTime (google.protobuf.Empty) returns (google.protobuf.Empty);
  32. }
  33. message FindOnlineCanMatchingPersonReply{
  34. repeated FindOnlineCanMatchingPersonInfo list = 1;
  35. }
  36. message FindOnlineCanMatchingPersonInfo{
  37. int64 todayMatchedNum = 1;// 今日被匹配数
  38. string personId = 2;
  39. int64 weight = 3;// 权重
  40. string workingStatus = 4;// 工作状态
  41. int64 sex = 5;// 性别
  42. int64 age = 6;// 年龄
  43. string province = 7;// 省
  44. string city = 8;// 市
  45. string lastLoginTime = 9;
  46. }
  47. message OnlinePersonReply{
  48. int64 userManNum = 1; // 男用户在线数
  49. int64 userWomanNum = 2; // 女用户在线数
  50. int64 userOtherNum = 3; // 未填写性别的用户在线数
  51. }
  52. message CheckIsOnlineRequest{
  53. string userId = 1;// 身份ID
  54. }
  55. message CheckIsOnlineByIDsParam{
  56. repeated string userIds = 1;// 身份ID
  57. }
  58. message CheckIsOnlineReply{
  59. bool isOnline = 1;// 是否在线
  60. }
  61. message UpdateWorkingStatusRequest{
  62. string id = 1;
  63. string workingStatus = 2;
  64. }
  65. message UpdateWeightRequest{
  66. string id = 1;
  67. int64 weight = 2;
  68. }
  69. message UpdateTodayMatchedNumRequest{
  70. string id = 1;
  71. int64 todayMatchedNum = 2;
  72. }
  73. message MessageInfo{
  74. int64 roomId = 1; // 房间ID
  75. string message = 2;// 发送的消息
  76. string msgType = 3;// 消息类型
  77. }
  78. message SendMsgRequest{
  79. string id = 1;
  80. string method = 2;
  81. bytes data = 3;
  82. int32 code = 4;
  83. string message = 5;
  84. string websocketTag = 6;
  85. bool isSelf = 7;// 是否是给自己发送的
  86. int64 messageId = 8;// 消息id
  87. }
  88. message SendMsgReply{
  89. }
  90. message FindOnlinePersonReply{
  91. repeated OnlinePersonInfo list = 1;
  92. }
  93. message OnlinePersonInfo{
  94. string personId = 2;
  95. int64 weight = 3;// 权重
  96. string workingStatus = 4;// 工作状态
  97. int64 sex = 5;// 性别
  98. string lastLoginTime = 6;
  99. }