opinion.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package blocked
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // const opinion
  6. const (
  7. // vote_desc
  8. NoVote = int8(0)
  9. BlockedVote = int8(1)
  10. RuleVote = int8(2)
  11. DeleteVote = int8(3)
  12. BlockedDelete = int8(4)
  13. // vote_state
  14. VoteStateON = int8(0)
  15. VoteStateOFF = int8(1)
  16. // attr
  17. AttrStateOFF = int8(0) // 匿名
  18. AttrStateOn = int8(1) // 展示
  19. )
  20. // var opinion
  21. var (
  22. VoteDesc = map[int8]string{
  23. NoVote: "未投票",
  24. BlockedVote: "违规",
  25. RuleVote: "不违规",
  26. DeleteVote: "弃权",
  27. BlockedDelete: "违规删除",
  28. }
  29. AttrDesc = map[int8]string{
  30. AttrStateOFF: "匿名",
  31. AttrStateOn: "展示",
  32. }
  33. VoteStateDesc = map[int8]string{
  34. VoteStateON: "正常",
  35. VoteStateOFF: "删除",
  36. }
  37. )
  38. // Opinion opinion struct.
  39. type Opinion struct {
  40. ID int64 `gorm:"column:id" json:"id"`
  41. VID int64 `gorm:"column:vid" json:"vid"`
  42. CID int64 `gorm:"column:cid" json:"cid"`
  43. MID int64 `gorm:"column:mid" json:"mid"`
  44. OperID int64 `gorm:"column:oper_id" json:"oper_id"`
  45. Vote int8 `gorm:"column:vote" json:"vote"`
  46. State int8 `gorm:"column:state" json:"state"`
  47. Attr int8 `gorm:"column:attr" json:"attr"`
  48. Likes int `gorm:"column:likes" json:"likes"`
  49. Hates int `gorm:"column:hates" json:"hates"`
  50. Content string `gorm:"column:content" json:"content"`
  51. CTime xtime.Time `gorm:"column:ctime" json:"ctime"`
  52. UName string `gorm:"-" json:"uname"`
  53. AttrDesc string `gorm:"-" json:"attr_desc"`
  54. VoteDesc string `gorm:"-" json:"vote_desc"`
  55. VoteStateDesc string `gorm:"-" json:"vote_state_desc"`
  56. OPName string `gorm:"-" json:"oname"`
  57. Fans int64 `gorm:"-" json:"fans"`
  58. }
  59. // TableName blocked_opinion tablename
  60. func (*Opinion) TableName() string {
  61. return "blocked_opinion"
  62. }
  63. // OpinionList is Opinion list.
  64. type OpinionList struct {
  65. Count int `json:"count"`
  66. Order string `json:"order"`
  67. Sort string `json:"sort"`
  68. PN int `json:"pn"`
  69. PS int `json:"ps"`
  70. IDs []int64 `json:"-"`
  71. List []*Opinion `json:"list"`
  72. }
  73. // OpinionCaseResult struct.
  74. type OpinionCaseResult struct {
  75. CID int64 `gorm:"column:cid"`
  76. MID int64 `gorm:"column:mid"`
  77. VID int64 `gorm:"column:mid"`
  78. Content string `gorm:"column:content"`
  79. }