business.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package model
  2. import xtime "go-common/library/time"
  3. const (
  4. // 业务bid 对应manager项目子业务
  5. // ArchiveComplain 稿件投诉
  6. ArchiveComplain = 1
  7. // ArchiveAppeal 稿件申诉
  8. ArchiveAppeal = 2
  9. // ReviewShortComplain 短点评投诉
  10. ReviewShortComplain = 3
  11. // ReviewLongComplain 长点评投诉
  12. ReviewLongComplain = 4
  13. // CreditAppeal 小黑屋申诉
  14. CreditAppeal = 5
  15. // ArchiveAudit 稿件审核
  16. ArchiveAudit = 6
  17. // ArchiveVT 任务质检
  18. ArchiveVT = 7
  19. // ChannelComplain 频道举报
  20. ChannelComplain = 9
  21. // CommentComplain 评论举报
  22. CommentComplain = 13
  23. // SubtitleComplain 字幕举报
  24. SubtitleComplain = 14
  25. )
  26. // Business will record any business properties
  27. type Business struct {
  28. Bid int32 `json:"-" gorm:"column:id"`
  29. Gid int64 `json:"gid" gorm:"column:gid"`
  30. Cid int64 `json:"cid" gorm:"column:cid"`
  31. Oid int64 `json:"oid" gorm:"column:oid"`
  32. Business int8 `json:"business" gorm:"column:business"`
  33. TypeID int32 `json:"typeid" gorm:"column:typeid"`
  34. Title string `json:"title" gorm:"column:title"`
  35. Content string `json:"content" gorm:"column:content"`
  36. Mid int64 `json:"mid" gorm:"column:mid"`
  37. Extra string `json:"extra" gorm:"column:extra"`
  38. CTime xtime.Time `json:"-" gorm:"column:ctime"`
  39. MTime xtime.Time `json:"-" gorm:"column:mtime"`
  40. }
  41. // Meta is the model to store business metadata
  42. type Meta struct {
  43. Business int8 `json:"business"`
  44. Name string `json:"name"`
  45. ItemType string `json:"item_type"`
  46. Rounds []*Round `json:"rounds"`
  47. Attr *BusinessAttr `json:"attr"`
  48. }
  49. // MetaSlice is used to support sort Metas
  50. type MetaSlice []*Meta
  51. func (ms MetaSlice) Len() int {
  52. return len(ms)
  53. }
  54. func (ms MetaSlice) Swap(i, j int) {
  55. ms[i], ms[j] = ms[j], ms[i]
  56. }
  57. func (ms MetaSlice) Less(i, j int) bool {
  58. return ms[i].Business < ms[j].Business
  59. }
  60. // Round is the model to describe how many business rounds are
  61. type Round struct {
  62. ID int8 `json:"id"`
  63. Name string `json:"name"`
  64. }
  65. // RoundSlice is used to support sort Rounds
  66. type RoundSlice []*Round
  67. func (rs RoundSlice) Len() int {
  68. return len(rs)
  69. }
  70. func (rs RoundSlice) Swap(i, j int) {
  71. rs[i], rs[j] = rs[j], rs[i]
  72. }
  73. func (rs RoundSlice) Less(i, j int) bool {
  74. return rs[i].ID < rs[j].ID
  75. }