credit.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. package model
  2. import (
  3. "fmt"
  4. xtime "go-common/library/time"
  5. )
  6. // CreditInfo credit info.
  7. type CreditInfo struct {
  8. Mid int64 `json:"mid"`
  9. Status int64 `json:"status"`
  10. PunishType int64 `json:"blockedType"`
  11. PunishEnd xtime.Time `json:"punishEnd"`
  12. CTime xtime.Time `json:"-"`
  13. MTime xtime.Time `json:"mtime"`
  14. }
  15. // BlockedInfo blocked case info.
  16. type BlockedInfo struct {
  17. ID int64 `json:"id"`
  18. Uname string `json:"uname"`
  19. Face string `json:"face"`
  20. UID int64 `json:"uid"`
  21. OriginTitle string `json:"originTitle"`
  22. BlockedRemark string `json:"blockedRemark"`
  23. OriginURL string `json:"originUrl"`
  24. OriginContent string `json:"originContent,omitempty"`
  25. OriginContentModify string `json:"originContentModify"`
  26. OriginType int64 `json:"originType"`
  27. OriginTypeName string `json:"originTypeName"`
  28. PunishTitle string `json:"punishTitle"`
  29. PunishTime xtime.Time `json:"punishTime"`
  30. PunishType int64 `json:"punishType"`
  31. PunishTypeName string `json:"punishTypeName"`
  32. MoralNum int64 `json:"moralNum"`
  33. BlockedDays int64 `json:"blockedDays"`
  34. PublishStatus int64 `json:"publishStatus"`
  35. BlockedType int64 `json:"blockedType"`
  36. BlockedForever int64 `json:"blockedForever"`
  37. ReasonType int64 `json:"reasonType"`
  38. ReasonTypeName string `json:"reasonTypeName"`
  39. OperatorName string `json:"operatorName"`
  40. CaseID int64 `json:"caseId"`
  41. PublishTime xtime.Time `json:"-"`
  42. CTime xtime.Time `json:"ctime"`
  43. MTime xtime.Time `json:"-"`
  44. CommentSum int64 `json:"commentSum"`
  45. OID int64 `json:"-"`
  46. }
  47. // BlockedPublish blocked publish info.
  48. type BlockedPublish struct {
  49. ID int64 `json:"id"`
  50. Title string `json:"title"`
  51. SubTitle string `json:"subTitle"`
  52. PublishStatus int8 `json:"publishStatus"`
  53. StickStatus int8 `json:"stickStatus"`
  54. Content string `json:"content"`
  55. CTime xtime.Time `json:"ctime"`
  56. MTime xtime.Time `json:"mtime"`
  57. URL string `json:"url"`
  58. }
  59. // BlockedCase blocked case info.
  60. type BlockedCase struct {
  61. ID int64 `json:"id"`
  62. MID int64 `json:"mid"`
  63. Status int8 `json:"status"`
  64. StatusTitle string `json:"statusTitle,omitempty"`
  65. OriginType int8 `json:"originType"`
  66. ReasonType int8 `json:"reasonType"`
  67. OriginContent string `json:"originContent"`
  68. PunishResult int64 `json:"punishResult"`
  69. PunishTitle string `json:"punishTitle,omitempty"`
  70. JudgeType int8 `json:"judgeType"`
  71. OriginURL string `json:"originUrl"`
  72. BlockedDays int32 `json:"blockedDays"`
  73. PutTotal int64 `json:"putTotal"`
  74. VoteRule int64 `json:"voteRule"`
  75. VoteBreak int64 `json:"voteBreak"`
  76. VoteDelete int64 `json:"voteDelete"`
  77. StartTime xtime.Time `json:"startTime"`
  78. EndTime xtime.Time `json:"endTime"`
  79. Operator string `json:"-"`
  80. CTime xtime.Time `json:"ctime"`
  81. MTime xtime.Time `json:"mtime"`
  82. OriginTitle string `json:"originTitle"`
  83. RelationID string `json:"relationId"`
  84. Face string `json:"face"`
  85. Uname string `json:"uname"`
  86. Vote int8 `json:"vote"`
  87. VoteTime xtime.Time `json:"voteTime,omitempty"`
  88. ExpiredMillis int64 `json:"expiredMillis,omitempty"`
  89. CaseType int8 `json:"case_type"`
  90. }
  91. // BlockedCaseVote blocked_case_vote.
  92. type BlockedCaseVote struct {
  93. ID int64 `json:"id"`
  94. CID int64 `json:"cid"`
  95. MID int64 `json:"mid"`
  96. Vote int8 `json:"vote"`
  97. CTime xtime.Time `json:"ctime"`
  98. MTime xtime.Time `json:"mtime"`
  99. Expired xtime.Time `json:"expired"`
  100. }
  101. // BlockedJury blocked jury info.
  102. type BlockedJury struct {
  103. ID int64 `json:"id"`
  104. MID int64 `json:"mid"`
  105. Status int8 `json:"status"`
  106. Expired xtime.Time `json:"expired"`
  107. InvalidReason int8 `json:"invalidReason"`
  108. VoteTotal int64 `json:"voteTotal"`
  109. CaseTotal int64 `json:"caseTotal"`
  110. VoteRadio int64 `json:"voteRadio"`
  111. CTime xtime.Time `json:"ctime"`
  112. MTime xtime.Time `json:"mtime"`
  113. VoteRight int64 `json:"voteRight"`
  114. Black int8 `json:"black"`
  115. }
  116. // JuryRequirement jury requirement info.
  117. type JuryRequirement struct {
  118. Blocked bool `json:"blocked"`
  119. Cert bool `json:"cert"`
  120. Level bool `json:"level"`
  121. Rule bool `json:"rule"`
  122. }
  123. //UserInfo jury interface
  124. type UserInfo struct {
  125. CaseTotal int64 `json:"caseTotal"`
  126. Face string `json:"face"`
  127. RestDays int64 `json:"restDays"`
  128. RightRadio int64 `json:"rightRadio"`
  129. Status int8 `json:"status"`
  130. Uname string `json:"uname"`
  131. }
  132. // BlockedConfig config struct.
  133. type BlockedConfig struct {
  134. CaseGiveHours string `json:"caseGiveHours"`
  135. CaseCheckHours string `json:"caseCheckHours"`
  136. JuryVoteRadio string `json:"juryVoteRadio"`
  137. CaseJudgeRadio string `json:"caseJudgeRadio"`
  138. CaseVoteMin string `json:"caseVoteMin"`
  139. }
  140. // VoteInfo vote info.
  141. type VoteInfo struct {
  142. ID int64 `json:"id"`
  143. MID int64 `json:"mid"`
  144. Vote int8 `json:"vote"`
  145. CID int64 `json:"cid"`
  146. Expired xtime.Time `json:"expired"`
  147. Mtime xtime.Time `json:"mtime"`
  148. }
  149. // CaseInfo struct
  150. type CaseInfo struct {
  151. EndTime xtime.Time `json:"endTime"`
  152. Face string `json:"face"`
  153. ID int64 `json:"id"`
  154. OriginContent string `json:"originContent"`
  155. OriginTitle string `json:"originTitle"`
  156. OriginURL string `json:"originUrl"`
  157. Status int8 `json:"status"`
  158. UID int64 `json:"uid"`
  159. Uname string `json:"uname"`
  160. VoteBreak int64 `json:"voteBreak"`
  161. VoteRule int64 `json:"voteRule"`
  162. }
  163. // Build set blocked title info.
  164. func (bi *BlockedInfo) Build() {
  165. bi.OriginTypeName = _originType[int8(bi.OriginType)]
  166. bi.ReasonTypeName = _reasonType[int8(bi.ReasonType)]
  167. bi.PunishTypeName = _punishType[int8(bi.PunishType)]
  168. bi.PunishTitle = fmt.Sprintf("在%s中%s", bi.OriginTypeName, bi.ReasonTypeName)
  169. }
  170. // Build set blocked title info.
  171. func (bc *BlockedCase) Build() {
  172. bc.PunishTitle = fmt.Sprintf("在%s中%s", _originType[int8(bc.OriginType)], _reasonType[int8(bc.ReasonType)])
  173. }
  174. // CheckVote check vote.
  175. func CheckVote(vote int8) (ok bool) {
  176. if vote == VoteBanned || vote == VoteRule || vote == VoteAbstain || vote == VoteDel {
  177. ok = true
  178. }
  179. return
  180. }
  181. // IsCaseTypePublic is case type public.
  182. func IsCaseTypePublic(caseType int8) (ok bool) {
  183. if caseType == JudeCaseTypePublic {
  184. ok = true
  185. }
  186. return
  187. }
  188. // GantMedalID .
  189. func (bj *BlockedJury) GantMedalID() int64 {
  190. switch bj.CaseTotal {
  191. case GuardMedalPointC:
  192. return GuardMedalC
  193. case GuardMedalPointB:
  194. return GuardMedalB
  195. case GuardMedalPointA:
  196. return GuardMedalA
  197. }
  198. return GuardMedalNone
  199. }