vote.proto 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-household-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. }
  65. message VoteListReply {
  66. int64 total = 1;
  67. int64 page = 2;
  68. repeated VoteItem list = 3;
  69. }
  70. message VoteTopicAnswer {
  71. // 题目编号
  72. int64 number = 1;
  73. // 题目类型
  74. int32 topic_type = 2;
  75. // 问答题回答,当题目类型为问答题时有效
  76. repeated string completion_answers = 3;
  77. // 选择题回答,当题目类型为选择题时有效
  78. repeated string choice_answers = 4;
  79. // 评分题回答,当题目类型为评分题时有效
  80. int32 star_answers = 5;
  81. }
  82. message VoteAddAnswerRequest {
  83. int64 id = 1;
  84. int64 garden_id = 2;
  85. int64 uid = 3;
  86. repeated VoteTopicAnswer answers = 4;
  87. }
  88. message VoteAddAnswerReply {
  89. }
  90. message VoteResultListRequest {
  91. int64 id = 1;
  92. int64 garden_id = 2;
  93. int64 page = 3;
  94. int64 page_size = 4;
  95. }
  96. message VoteResultData {
  97. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  98. int32 topic_type = 1;
  99. string topic_name = 2;
  100. // 总星数,当为评分题时有效
  101. int32 star = 3;
  102. // 是否必选
  103. bool must = 4;
  104. // 题目编号
  105. int64 number = 5;
  106. // 选择题的选项
  107. repeated VoteTopicChoiceItem choice_items = 6;
  108. // 问答题回答,当题目类型为问答题时有效
  109. repeated string completion_answers = 7;
  110. // 选择题回答,当题目类型为选择题时有效
  111. repeated string choice_answers = 8;
  112. // 评分题回答,当题目类型为评分题时有效
  113. int32 star_answers = 9;
  114. }
  115. message VoteResultUserAnswerItem {
  116. // 用户uid
  117. int64 uid = 1;
  118. repeated VoteResultData answers = 2;
  119. }
  120. message VoteResultListReply {
  121. int64 page = 1;
  122. int64 total = 2;
  123. repeated VoteResultUserAnswerItem list = 3;
  124. }
  125. message VoteResultStatisticRequest {
  126. int64 id = 1;
  127. int64 garden_id = 2;
  128. }
  129. message VoteResultStatisticChoice {
  130. // 选择选项标识
  131. string flag = 1;
  132. // 该选项被选的用户
  133. int32 count = 2;
  134. }
  135. message VoteResultStatisticStar {
  136. // 评分星数
  137. int32 star = 1;
  138. // 评该星数的用户数量
  139. int32 count = 2;
  140. }
  141. message VoteResultStatisticItem {
  142. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  143. int32 topic_type = 1;
  144. string topic_name = 2;
  145. // 总星数,当为评分题时有效
  146. int32 star = 3;
  147. // 是否必选
  148. bool must = 4;
  149. // 题目编号
  150. int64 number = 5;
  151. // 选择题的选项内容
  152. repeated VoteTopicChoiceItem choice_items = 6;
  153. // 选择题的选项回答统计,当题目类型为选择题时有效
  154. repeated VoteResultStatisticChoice choice_statistic = 7;
  155. // 评分题的分数回答统计,当题目类型为评分题时有效
  156. repeated VoteResultStatisticStar star_statistic = 8;
  157. // 平均分, 当题目类型为评分题时有效
  158. int32 star_avg = 9;
  159. }
  160. message VoteResultStatisticReply {
  161. // 题目统计
  162. repeated VoteResultStatisticItem list = 1;
  163. }
  164. message VoteListForHouseholdRequest {
  165. int64 garden_id = 1;
  166. int64 uid = 2;
  167. int64 page = 3;
  168. int64 page_size = 4;
  169. string title = 5;
  170. }
  171. message VoteTopicForHouseholdItem {
  172. // 题目类型 1 填空题 2 单选题 3 多选题 4 评分题
  173. int32 topic_type = 1;
  174. string topic_name = 2;
  175. // 总星数,当为评分题时有效
  176. int32 star = 3;
  177. // 是否必选
  178. bool must = 4;
  179. // 题目编号
  180. int64 number = 5;
  181. // 选择题的选项
  182. repeated VoteTopicChoiceItem choice_items = 6;
  183. // 当已投票时,以下字段有效
  184. // 问答题回答,当题目类型为问答题时有效
  185. repeated string completion_answers = 7;
  186. // 选择题回答,当题目类型为选择题时有效
  187. repeated string choice_answers = 8;
  188. // 评分题回答,当题目类型为评分题时有效
  189. int32 star_answers = 9;
  190. }
  191. message VoteListForHouseholdItem {
  192. // 标题
  193. string title = 1;
  194. repeated string pics = 2;
  195. int64 start = 3;
  196. int64 end = 4;
  197. int64 id = 5;
  198. int64 created_at = 6;
  199. // 是否已投票
  200. bool answered = 7;
  201. // 题目类容和用户回答
  202. repeated VoteTopicForHouseholdItem topics = 8;
  203. }
  204. message VoteListForHouseholdReply {
  205. int64 page = 1;
  206. int64 total = 2;
  207. repeated VoteListForHouseholdItem list = 3;
  208. }