vote.proto 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-system-gateway/pb/v1";
  6. message VoteTopicChoiceItem {
  7. string flag = 1;
  8. string text = 2;
  9. }
  10. message VoteTopic {
  11. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  12. int32 topic_type = 1;
  13. string topic_name = 2;
  14. // 总星数,当为评分题时有效
  15. int32 star = 3;
  16. // 是否必选
  17. bool must = 4;
  18. // 题目编号
  19. int64 number = 5;
  20. // 选择题的选项
  21. repeated VoteTopicChoiceItem choice_items = 6;
  22. }
  23. message VoteAddRequest {
  24. string title = 1;
  25. repeated string pics = 2;
  26. int64 start = 3;
  27. int64 end = 4;
  28. int64 garden_id = 5;
  29. repeated VoteTopic topics = 6;
  30. }
  31. message VoteAddReply {
  32. }
  33. message VoteUpdateRequest {
  34. int64 id = 1;
  35. string title = 2;
  36. repeated string pics = 3;
  37. int64 start = 4;
  38. int64 end = 5;
  39. int64 garden_id = 6;
  40. repeated VoteTopic topics = 7;
  41. }
  42. message VoteUpdateReply {
  43. }
  44. message VoteDelRequest {
  45. int64 id = 1;
  46. int64 garden_id = 2;
  47. }
  48. message VoteDelReply {
  49. }
  50. message VoteListRequest {
  51. int64 garden_id = 1;
  52. string title = 2;
  53. int64 page = 3;
  54. int64 page_size = 4;
  55. }
  56. message VoteItem {
  57. string title = 1;
  58. repeated string pics = 2;
  59. int64 start = 3;
  60. int64 end = 4;
  61. int64 id = 5;
  62. int64 created_at = 6;
  63. repeated VoteTopic topics = 7;
  64. int64 user_count = 8;
  65. }
  66. message VoteListReply {
  67. int64 total = 1;
  68. int64 page = 2;
  69. repeated VoteItem list = 3;
  70. }
  71. message VoteTopicAnswer {
  72. // 题目编号
  73. int64 number = 1;
  74. // 题目类型
  75. int32 topic_type = 2;
  76. // 问答题回答,当题目类型为问答题时有效
  77. repeated string completion_answers = 3;
  78. // 选择题回答,当题目类型为选择题时有效
  79. repeated string choice_answers = 4;
  80. // 评分题回答,当题目类型为评分题时有效
  81. int32 star_answers = 5;
  82. }
  83. message VoteAddAnswerRequest {
  84. int64 id = 1;
  85. int64 garden_id = 2;
  86. int64 uid = 3;
  87. repeated VoteTopicAnswer answers = 4;
  88. }
  89. message VoteAddAnswerReply {
  90. }
  91. message VoteResultListRequest {
  92. int64 id = 1;
  93. int64 garden_id = 2;
  94. int64 page = 3;
  95. int64 page_size = 4;
  96. int64 number = 5;
  97. }
  98. message VoteResultData {
  99. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  100. int32 topic_type = 1;
  101. string topic_name = 2;
  102. // 总星数,当为评分题时有效
  103. int32 star = 3;
  104. // 是否必选
  105. bool must = 4;
  106. // 题目编号
  107. int64 number = 5;
  108. // 选择题的选项
  109. repeated VoteTopicChoiceItem choice_items = 6;
  110. // 问答题回答,当题目类型为问答题时有效
  111. repeated string completion_answers = 7;
  112. // 选择题回答,当题目类型为选择题时有效
  113. repeated string choice_answers = 8;
  114. // 评分题回答,当题目类型为评分题时有效
  115. int32 star_answers = 9;
  116. }
  117. message VoteResultUserAnswerItem {
  118. // 用户uid
  119. int64 uid = 1;
  120. VoteResultData answer = 2;
  121. string user_name = 3;
  122. }
  123. message VoteResultListReply {
  124. int64 page = 1;
  125. int64 total = 2;
  126. repeated VoteResultUserAnswerItem list = 3;
  127. }
  128. message VoteResultStatisticRequest {
  129. int64 id = 1;
  130. int64 garden_id = 2;
  131. }
  132. message VoteResultStatisticChoice {
  133. // 选择选项标识
  134. string flag = 1;
  135. // 该选项被选的用户
  136. int32 count = 2;
  137. string text = 3;
  138. }
  139. message VoteResultStatisticStar {
  140. // 评分星数
  141. int32 star = 1;
  142. // 评该星数的用户数量
  143. int32 count = 2;
  144. }
  145. message VoteResultStatisticItem {
  146. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  147. int32 topic_type = 1;
  148. string topic_name = 2;
  149. // 总星数,当为评分题时有效
  150. int32 star = 3;
  151. // 是否必选
  152. bool must = 4;
  153. // 题目编号
  154. int64 number = 5;
  155. // 选择题的选项内容
  156. repeated VoteTopicChoiceItem choice_items = 6;
  157. // 选择题的选项回答统计,当题目类型为选择题时有效
  158. repeated VoteResultStatisticChoice choice_statistic = 7;
  159. // 评分题的分数回答统计,当题目类型为评分题时有效
  160. repeated VoteResultStatisticStar star_statistic = 8;
  161. // 平均分, 当题目类型为评分题时有效
  162. double star_avg = 9;
  163. }
  164. message VoteResultStatisticReply {
  165. // 题目统计
  166. repeated VoteResultStatisticItem list = 1;
  167. }
  168. message VoteListForHouseholdRequest {
  169. int64 garden_id = 1;
  170. int64 uid = 2;
  171. int64 page = 3;
  172. int64 page_size = 4;
  173. string title = 5;
  174. }
  175. message VoteTopicForHouseholdItem {
  176. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  177. int32 topic_type = 1;
  178. string topic_name = 2;
  179. // 总星数,当为评分题时有效
  180. int32 star = 3;
  181. // 是否必选
  182. bool must = 4;
  183. // 题目编号
  184. int64 number = 5;
  185. // 选择题的选项
  186. repeated VoteTopicChoiceItem choice_items = 6;
  187. // 当已投票时,以下字段有效
  188. // 问答题回答,当题目类型为问答题时有效
  189. repeated string completion_answers = 7;
  190. // 选择题回答,当题目类型为选择题时有效
  191. repeated string choice_answers = 8;
  192. // 评分题回答,当题目类型为评分题时有效
  193. int32 star_answers = 9;
  194. }
  195. message VoteListForHouseholdItem {
  196. // 标题
  197. string title = 1;
  198. repeated string pics = 2;
  199. int64 start = 3;
  200. int64 end = 4;
  201. int64 id = 5;
  202. int64 created_at = 6;
  203. // 是否已投票
  204. bool answered = 7;
  205. // 题目类容和用户回答
  206. repeated VoteTopicForHouseholdItem topics = 8;
  207. }
  208. message VoteListForHouseholdReply {
  209. int64 page = 1;
  210. int64 total = 2;
  211. repeated VoteListForHouseholdItem list = 3;
  212. }