user_resource.proto 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. syntax = "proto3";
  2. package live.liveadmin.v2;
  3. option go_package = "v2";
  4. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  5. // 请求创建资源
  6. message UserResourceAddReq {
  7. //资源类型
  8. int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
  9. //名称
  10. string title = 2 [(gogoproto.moretags) = 'form:"title" validate:"required"'];
  11. //URL
  12. string url = 3 [(gogoproto.moretags) = 'form:"url" validate:"required"'];
  13. //权重
  14. int32 weight = 4 [(gogoproto.moretags) = 'form:"weight" validate:"required"'];
  15. //创建人
  16. string creator = 5 [(gogoproto.moretags) = 'form:"creator" validate:"required"'];
  17. }
  18. // 返回创建结果
  19. message UserResourceAddResp {
  20. //ID
  21. int32 id = 1 [(gogoproto.jsontag) = "id"];
  22. //资源ID
  23. int32 custom_id = 3 [(gogoproto.jsontag) = "custom_id"];
  24. }
  25. // 请求编辑资源
  26. message UserResourceEditReq {
  27. //资源类型
  28. int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
  29. //资源ID
  30. int32 custom_id = 2 [(gogoproto.moretags) = 'form:"custom_id" validate:"required"'];
  31. //名称
  32. string title = 3 [(gogoproto.moretags) = 'form:"title"'];
  33. //URL
  34. string url = 4 [(gogoproto.moretags) = 'form:"url"'];
  35. //权重
  36. int32 weight = 5 [(gogoproto.moretags) = 'form:"weight"'];
  37. }
  38. // 返回编辑结果
  39. message UserResourceEditResp {
  40. }
  41. // 请求资源列表
  42. message UserResourceListReq {
  43. //资源类型
  44. int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
  45. //页码
  46. int32 page = 2 [(gogoproto.moretags) = 'form:"page"'];
  47. //每页数据量
  48. int32 page_size = 3 [(gogoproto.moretags) = 'form:"page_size"'];
  49. }
  50. // 返回资源列表
  51. message UserResourceListResp {
  52. int32 currentPage = 1 [(gogoproto.jsontag) = "currentPage"];
  53. int32 totalCount = 2 [(gogoproto.jsontag) = "totalCount"];
  54. repeated List list = 3 [(gogoproto.jsontag) = "list"];
  55. message List {
  56. //ID
  57. int32 id = 1 [(gogoproto.jsontag) = "id"];
  58. //资源类型
  59. int32 res_type = 2 [(gogoproto.jsontag) = "res_type"];
  60. //资源ID
  61. int32 custom_id = 3 [(gogoproto.jsontag) = "custom_id"];
  62. //名称
  63. string title = 4 [(gogoproto.jsontag) = "title"];
  64. //URL
  65. string url = 5 [(gogoproto.jsontag) = "url"];
  66. //权重
  67. int32 weight = 6 [(gogoproto.jsontag) = "weight"];
  68. //创建人
  69. string creator = 7 [(gogoproto.jsontag) = "creator"];
  70. //"状态1.上线中2.下线"
  71. int32 status = 8 [(gogoproto.jsontag) = "status"];
  72. //创建时刻
  73. string ctime = 9 [(gogoproto.jsontag) = "ctime"];
  74. //修改时刻
  75. string mtime = 10 [(gogoproto.jsontag) = "mtime"];
  76. }
  77. }
  78. // 请求变更资源状态
  79. message UserResourceSetStatusReq {
  80. //资源类型
  81. int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
  82. //页码
  83. int32 custom_id = 2 [(gogoproto.moretags) = 'form:"custom_id" validate:"required"'];
  84. //每页数据量
  85. int32 status = 3 [(gogoproto.moretags) = 'form:"status" validate:"required"'];
  86. }
  87. // 返回变更结果
  88. message UserResourceSetStatusResp {
  89. }
  90. // 请求单个资源
  91. message UserResourceGetSingleReq {
  92. //资源类型
  93. int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
  94. //资源ID
  95. int32 custom_id = 2 [(gogoproto.moretags) = 'form:"custom_id" validate:"required"'];
  96. }
  97. // 返回单个资源
  98. message UserResourceGetSingleResp {
  99. //ID
  100. int32 id = 1 [(gogoproto.jsontag) = "id"];
  101. //资源类型
  102. int32 res_type = 2 [(gogoproto.jsontag) = "res_type"];
  103. //资源ID
  104. int32 custom_id = 3 [(gogoproto.jsontag) = "custom_id"];
  105. //名称
  106. string title = 4 [(gogoproto.jsontag) = "title"];
  107. //URL
  108. string url = 5 [(gogoproto.jsontag) = "url"];
  109. //权重
  110. int32 weight = 6 [(gogoproto.jsontag) = "weight"];
  111. //创建人
  112. string creator = 7 [(gogoproto.jsontag) = "creator"];
  113. //"状态1.上线中2.下线"
  114. int32 status = 8 [(gogoproto.jsontag) = "status"];
  115. //创建时刻
  116. string ctime = 9 [(gogoproto.jsontag) = "ctime"];
  117. //修改时刻
  118. string mtime = 10 [(gogoproto.jsontag) = "mtime"];
  119. }
  120. service UserResource {
  121. //Add 添加资源接口
  122. // `method:"POST" internal:"true" `
  123. rpc add(UserResourceAddReq) returns (UserResourceAddResp);
  124. //Edit 编辑现有资源
  125. // `method:"POST" internal:"true" `
  126. rpc edit(UserResourceEditReq) returns (UserResourceEditResp);
  127. //List 获取资源列表
  128. // `method:"GET" internal:"true" `
  129. rpc get(UserResourceListReq) returns (UserResourceListResp);
  130. //SetStatus 更改资源状态
  131. // `method:"POST" internal:"true" `
  132. rpc setStatus(UserResourceSetStatusReq) returns (UserResourceSetStatusResp);
  133. //Query 请求单个资源
  134. // `method:"GET" internal:"true" `
  135. rpc getSingle(UserResourceGetSingleReq) returns (UserResourceGetSingleResp);
  136. }