jury.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. package model
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // Case is jury case info.
  6. type Case struct {
  7. ID int64 `json:"id"`
  8. Mid int64 `json:"mid"`
  9. Status int64 `json:"status"`
  10. Origin
  11. JudgeType int64 `json:"judge_type"`
  12. PunishResult int64 `json:"punish_result"`
  13. Agree int64 `json:"vote_rule"`
  14. Against int64 `json:"vote_break"`
  15. VoteDelete int64 `json:"vote_delete"`
  16. PunishStatus int64 `json:"pubish_status"`
  17. BlockedDay int64 `json:"blocked_days"`
  18. RelationID string `json:"relation_id"`
  19. Operator string `json:"operator"`
  20. PutTotal int64 `json:"put_total"`
  21. Stime string `json:"start_time"`
  22. Etime string `json:"end_time"`
  23. Ctime string `json:"ctime"`
  24. CaseType int8 `json:"case_type"`
  25. OPID int64 `json:"oper_id"`
  26. BusinessTime string `json:"business_time"`
  27. BCtime xtime.Time
  28. }
  29. // Publish is blocked_publish info.
  30. type Publish struct {
  31. ID int64 `json:"id"`
  32. Title string `json:"title"`
  33. Subtitle string `json:"sub_title"`
  34. PStatus int8 `json:"publish_status"`
  35. SStatus int8 `json:"stick_status"`
  36. Content string `json:"content"`
  37. URL string `json:"url"`
  38. PType int8 `json:"ptype"`
  39. STime string `json:"show_time"`
  40. }
  41. // SimCase is simple case struct info.
  42. type SimCase struct {
  43. ID int64 `json:"id"`
  44. Mid int64 `json:"mid"`
  45. VoteRule int64 `json:"vote_rule"`
  46. VoteBreak int64 `json:"vote_break"`
  47. VoteDelete int64 `json:"vote_delete"`
  48. CaseType int8 `json:"case_type"`
  49. Stime xtime.Time `json:"start_time"`
  50. Etime xtime.Time `json:"end_time"`
  51. }
  52. // Jury is simple jury struct info.
  53. type Jury struct {
  54. ID int64 `json:"id"`
  55. Mid int64 `json:"mid"`
  56. Status int8 `json:"status"`
  57. }
  58. // CaseVote is simple caseVote struct info.
  59. type CaseVote struct {
  60. ID int64 `json:"id"`
  61. CID int64 `json:"cid"`
  62. MID int64 `json:"mid"`
  63. Vote int8 `json:"vote"`
  64. Expired xtime.Time `json:"expired"`
  65. }
  66. // BLogCaseVote is simple blogCaseVote struct info.
  67. type BLogCaseVote struct {
  68. ID int64 `json:"-"`
  69. CID int64 `json:"cid"`
  70. MID int64 `json:"mid"`
  71. Vote int8 `json:"-"`
  72. Expired string `json:"-"`
  73. Ctime string `json:"-"`
  74. Mtime string `json:"-"`
  75. }
  76. // Opinion is simple opinion struct info.
  77. type Opinion struct {
  78. Cid int64 `json:"cid"`
  79. Vid int64 `json:"vid"`
  80. Content string `json:"content"`
  81. State int8 `json:"state"`
  82. }
  83. // BlockDays get user blocked days.
  84. func (c *Case) BlockDays() (forever int8, days int64) {
  85. switch c.PunishResult {
  86. case Punish3Days:
  87. days = 3
  88. case Punish7Days:
  89. days = 7
  90. case Punish15Days:
  91. days = 15
  92. case PunishForever:
  93. forever = int8(1)
  94. case PunishCustom:
  95. days = c.BlockedDay
  96. }
  97. return
  98. }
  99. // Origin is origin info of blocked.
  100. type Origin struct {
  101. OriginTitle string `json:"origin_title"`
  102. OriginURL string `json:"origin_url"`
  103. OriginContent string `json:"origin_content"`
  104. OriginContentModify string `json:"origin_content_modify"`
  105. OriginType int64 `json:"origin_type"`
  106. ReasonType int64 `json:"reason_type"`
  107. }
  108. // BlockedInfo user block info.
  109. type BlockedInfo struct {
  110. ID int64 `json:"id"`
  111. UID int64 `json:"uid"`
  112. Origin
  113. BlockedRemark string `json:"blocked_remark"`
  114. PunishTime string `json:"punish_time"`
  115. PunishType int64 `json:"punish_type"`
  116. MoralNum int64 `json:"moral_num"`
  117. BlockedDays int64 `json:"blocked_days"`
  118. PublishStatus int64 `json:"publish_status"`
  119. BlockedType int64 `json:"blocked_type"`
  120. BlockedForever int8 `json:"blocked_forever"`
  121. OperatorName string `json:"operator_name"`
  122. CaseID int64 `json:"case_id"`
  123. OPID int64 `json:"oper_id"`
  124. Status int64 `json:"status"`
  125. MTime string `json:"mtime"`
  126. }
  127. // Kpi is jury kpi info.
  128. type Kpi struct {
  129. ID int64 `json:"id"`
  130. Mid int64 `json:"mid"`
  131. Rate int8 `json:"rate"`
  132. Rank int64 `json:"rank"`
  133. RankPer int64 `json:"rank_per"`
  134. RankTotal int64 `json:"rankTotal"`
  135. HandlerStatus int64 `json:"handlerStatus"`
  136. }
  137. // PunishResultDays punish res days.
  138. func PunishResultDays(blockedTimes int64) (punishResult, blockedDay int64) {
  139. switch {
  140. case blockedTimes == 0:
  141. punishResult = int64(Block7Days)
  142. blockedDay = BlockTimeSeven
  143. case blockedTimes == 1:
  144. punishResult = int64(Block15Days)
  145. blockedDay = BlockTimeFifteen
  146. case blockedTimes > 1:
  147. punishResult = int64(BlockForever)
  148. blockedDay = BlockTimeForever
  149. }
  150. return
  151. }