guard.proto 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. syntax = "proto3";
  2. package live.xuser.v1;
  3. option go_package = "v1";
  4. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  5. import "app/service/live/xuser/api/grpc/xuser.proto";
  6. message GuardBuyReq {
  7. string order_id = 1 [(gogoproto.moretags) = "validate:\"required\""];
  8. int64 uid = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
  9. int64 ruid = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
  10. int32 guard_level = 4 [(gogoproto.moretags) = "validate:\"gt=0,required\"", (gogoproto.casttype) = "int"];
  11. int32 num = 5 [(gogoproto.moretags) = "validate:\"gt=0,required\"", (gogoproto.casttype) = "int"];
  12. Platform platform = 6 [(gogoproto.moretags) = "validate:\"required\""];
  13. string source = 7 [(gogoproto.moretags) = "validate:\"required\""];
  14. }
  15. message GuardBuyReply {
  16. int32 status = 1 [(gogoproto.jsontag) = "status", (gogoproto.casttype) = "int"];
  17. }
  18. // GetByUidTargetIdReq 1:1请求
  19. message ClearUIDCacheReq {
  20. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  21. string magic_key = 2 [(gogoproto.moretags) = 'form:"magic_key" validate:"alpha,required"'];
  22. }
  23. message ClearUIDCacheResp {
  24. }
  25. // GetByUidTargetIdReq 1:1请求
  26. message GetByUidTargetIdReq {
  27. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  28. int64 target_id = 2 [(gogoproto.moretags) = 'form:"target_id" validate:"required"'];
  29. int64 sort_type = 3 [(gogoproto.moretags) = 'form:"sort_type" validate:"gte=0"'];
  30. }
  31. message GetByUidTargetIdResp {
  32. map<int64, DaHangHaiInfo> data = 1 [(gogoproto.jsontag) = "data"];
  33. }
  34. message AllDaHangHaiInfo {
  35. map<int64,DaHangHaiInfo> guardInfo = 1 [(gogoproto.moretags) = 'validate:"required"'];
  36. }
  37. message FilterDaHangHaiInfo {
  38. map<int64,DaHangHaiInfo> guardInfo = 1 [(gogoproto.moretags) = 'validate:"required"'];
  39. }
  40. message DaHangHaiInfo {
  41. // 主键
  42. int64 id = 1 [(gogoproto.jsontag) = "id"];
  43. // uid
  44. int64 uid = 2 [(gogoproto.jsontag) = "uid"];
  45. // target_id
  46. int64 target_id = 3 [(gogoproto.jsontag) = "target_id"];
  47. // 守护类型 1为总督,2为提督,3为舰长
  48. int64 privilege_type = 4 [(gogoproto.jsontag) = "privilege_type"];
  49. // start_time
  50. string start_time = 5 [(gogoproto.jsontag) = "start_time"];
  51. // expired_time
  52. string expired_time = 6 [(gogoproto.jsontag) = "expired_time"];
  53. // ctime
  54. string ctime = 7 [(gogoproto.jsontag) = "ctime"];
  55. // utime
  56. string utime = 8 [(gogoproto.jsontag) = "utime"];
  57. }
  58. message DaHangHaiInfoList {
  59. repeated DaHangHaiInfo list = 1 [(gogoproto.jsontag) = "list"];
  60. }
  61. message GetByUidTargetIdsReq {
  62. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  63. repeated TargetIds targetIDs = 2 [(gogoproto.moretags) = 'form:"targetIDs" validate:"required"'];
  64. }
  65. message GetByUidTargetIdsResp {
  66. map<int64, DaHangHaiInfo> data = 1 [(gogoproto.jsontag) = "data"];
  67. }
  68. message TargetIds {
  69. int64 target_id = 1 [(gogoproto.moretags) = 'form:"target_id" validate:"gt=0,required"'];
  70. int64 sort_type = 2 [(gogoproto.moretags) = 'form:"sort_type" validate:"gt=0"'];
  71. }
  72. // GetByTargetIdsBatchReq 根据uids批量获取所有守护关系
  73. message GetByTargetIdsReq {
  74. repeated TargetIds targetIDs = 1 [(gogoproto.moretags) = 'form:"targetIDs" validate:"required"'];
  75. }
  76. // TODO 实现
  77. message GetByTargetIdsResp {
  78. }
  79. // GetAllShouHuReq 目标全部守护数据
  80. message GetByUidReq {
  81. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  82. }
  83. message GetByUidResp {
  84. map<int64, DaHangHaiInfo> data = 1 [(gogoproto.jsontag) = "data"];
  85. }
  86. // GetAllShouHuBatchReq 目标全部守护数据(批量)
  87. message GetByUidBatchReq {
  88. repeated int64 uids = 1 [(gogoproto.moretags) = 'form:"uids" validate:"required"'];
  89. }
  90. message GetByUidBatchResp {
  91. map<int64, DaHangHaiInfoList> data = 1 [(gogoproto.jsontag) = "data"];
  92. }
  93. message GetAnchorRecentTopGuardReq{
  94. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  95. }
  96. message GetAnchorRecentTopGuardResp{
  97. // 主键
  98. int64 cnt = 1 [(gogoproto.jsontag) = "cnt"];
  99. repeated GetAnchorRecentTopGuardList list = 2 [(gogoproto.jsontag) = "list"];
  100. }
  101. message GetAnchorRecentTopGuardList{
  102. int64 uid = 1 [(gogoproto.jsontag) = "uid"];
  103. int64 end_time = 2 [(gogoproto.jsontag) = "end_time"];
  104. int64 is_open = 3 [(gogoproto.jsontag) = "is_open"];
  105. }
  106. message GetTopListGuardReq{
  107. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  108. int64 page = 2 [(gogoproto.moretags) = 'form:"page" validate:"gte=1"'];
  109. int64 page_size = 3 [(gogoproto.moretags) = 'form:"page_size" validate:"gte=1"'];
  110. }
  111. message GetTopListGuardResp{
  112. // 守护总数量
  113. int64 num = 1 [(gogoproto.jsontag) = "num"];
  114. int64 page = 2 [(gogoproto.jsontag) = "page"];
  115. int64 now = 3 [(gogoproto.jsontag) = "now"];
  116. repeated TopListGuard list = 4[(gogoproto.jsontag) = "list"];
  117. repeated TopListGuard top3 = 5[(gogoproto.jsontag) = "top3"];
  118. }
  119. message TopListGuard{
  120. int64 uid = 1 [(gogoproto.jsontag) = "uid"];
  121. int64 ruid = 2 [(gogoproto.jsontag) = "ruid"];
  122. int64 rank = 4 [(gogoproto.jsontag) = "rank"];
  123. int64 guard_level = 3 [(gogoproto.jsontag) = "guard_level"];
  124. }
  125. message GetTopListGuardNumReq{
  126. int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"gt=0,required"'];
  127. }
  128. message GetTopListGuardNumResp{
  129. int64 total_count = 1 [(gogoproto.jsontag) = "total_count"];
  130. }
  131. service Guard {
  132. // Buy 购买大航海
  133. rpc Buy(GuardBuyReq) returns (GuardBuyReply);
  134. // GetByUIDTargetID 获取我与目标用户守护关系,不支持批量(P0级)
  135. rpc GetByUIDTargetID (GetByUidTargetIdReq) returns (GetByUidTargetIdResp);
  136. // GetByTargetIdsBatch 获取我与目标用户守护关系,支持批量(P2级,必要时刻降级)
  137. rpc GetByTargetIdsBatch (GetByTargetIdsReq) returns (GetByTargetIdsResp);
  138. // GetByUIDTargetIds 根据uids批量获取所有守护关系,粉丝勋章使用
  139. rpc GetByUIDTargetIds (GetByUidTargetIdsReq) returns (GetByUidTargetIdsResp);
  140. // GetByUID 获取我所有的守护,不支持批量(P0级)
  141. rpc GetByUIDForGift (GetByUidReq) returns (GetByUidResp);
  142. // GetByUIDBatch 根据uids获取所有的守护,支持批量(P2级)
  143. rpc GetByUIDBatch (GetByUidBatchReq) returns (GetByUidBatchResp);
  144. // GetAnchorRecentTopGuard 获取最近的提督弹窗提醒
  145. rpc GetAnchorRecentTopGuard (GetAnchorRecentTopGuardReq) returns (GetAnchorRecentTopGuardResp);
  146. // GetTopListGuard 获取某个up主的守护排行榜
  147. rpc GetTopListGuard (GetTopListGuardReq) returns (GetTopListGuardResp);
  148. // GetTopListGuardNum 获取某个up主所有的守护数量,和GetTopListGuard接口的区别是此接口用于房间页首屏,逻辑比较简单,因此拆分开来
  149. rpc GetTopListGuardNum (GetTopListGuardNumReq) returns (GetTopListGuardNumResp);
  150. // ClearUIDCache 清除cache
  151. rpc ClearUIDCache (ClearUIDCacheReq) returns (ClearUIDCacheResp);
  152. }