category.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package music
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // consts for workflow event
  6. // Category model is the model for music
  7. type Category struct {
  8. ID int64 `json:"id" gorm:"column:id"`
  9. Pid int64 `json:"pid" gorm:"column:pid"`
  10. Name string `json:"name" gorm:"column:name"`
  11. Index int64 `json:"index" gorm:"column:index"`
  12. CameraIndex int64 `json:"camera_index" gorm:"column:camera_index"`
  13. State int8 `json:"state" gorm:"column:state"`
  14. CTime xtime.Time `json:"ctime" gorm:"column:ctime"`
  15. MTime xtime.Time `json:"mtime" gorm:"column:mtime"`
  16. }
  17. // TableName is used to identify table name in gorm
  18. func (Category) TableName() string {
  19. return "music_category"
  20. }
  21. // CategoryPager def.
  22. type CategoryPager struct {
  23. Items []*Category `json:"items"`
  24. Pager *Pager `json:"pager"`
  25. }
  26. // Pager Pager def.
  27. type Pager struct {
  28. Num int `json:"num"`
  29. Size int `json:"size"`
  30. Total int64 `json:"total"`
  31. }
  32. // SidNotify model is the model for music
  33. type SidNotify struct {
  34. Sid int64 `json:"sid"`
  35. MidFirst bool `json:"mid_first"`
  36. SidFirst bool `json:"sid_first"`
  37. }
  38. // WithCategory model is the model for music
  39. type WithCategory struct {
  40. ID int64 `json:"id" gorm:"column:id"`
  41. Sid int64 `json:"sid" gorm:"column:sid"`
  42. Tid int64 `json:"tid" gorm:"column:tid"`
  43. State int8 `json:"state" gorm:"column:state"`
  44. Index int64 `json:"index" gorm:"column:index"`
  45. CTime xtime.Time `json:"ctime" gorm:"column:ctime"`
  46. MTime xtime.Time `json:"mtime" gorm:"column:mtime"`
  47. }
  48. // TableName is used to identify table name in gorm
  49. func (WithCategory) TableName() string {
  50. return "music_with_category"
  51. }
  52. // WithCategoryPager def.
  53. type WithCategoryPager struct {
  54. TotalCount int64 `json:"total_count"`
  55. Pn int `json:"pn"`
  56. Ps int `json:"ps"`
  57. Items []*WithCategory `json:"items"`
  58. }
  59. //CategoryList .
  60. type CategoryList struct {
  61. ID int64 `json:"id" gorm:"column:id"`
  62. Sid int64 `json:"sid" gorm:"column:sid"`
  63. Name string `json:"name" gorm:"column:name"`
  64. FrontName string `json:"frontname" gorm:"column:frontname"`
  65. Musicians string `json:"musicians" gorm:"column:musicians"`
  66. Cooperate int8 `json:"cooperate" gorm:"column:cooperate"`
  67. Mid int64 `json:"mid" gorm:"column:mid"`
  68. Tid int64 `json:"tid" gorm:"-"`
  69. Pid int64 `json:"pid" gorm:"-"`
  70. Cover string `json:"cover" gorm:"column:cover"`
  71. MaterialName string `json:"material_name" gorm:"-"`
  72. CategoryName string `json:"category_name" gorm:"-"`
  73. MusicState string `json:"music_state" gorm:"-"`
  74. Stat string `json:"stat" gorm:"column:stat"`
  75. Categorys string `json:"categorys" gorm:"column:categorys"`
  76. Playurl string `json:"playurl" gorm:"column:playurl"`
  77. State int8 `json:"state" gorm:"column:state"`
  78. Index int `json:"index" gorm:"column:index"`
  79. Duration int32 `json:"duration" gorm:"column:duration"`
  80. Filesize int32 `json:"filesize" gorm:"column:filesize"`
  81. PubTime xtime.Time `json:"pubtime" gorm:"column:pubtime"`
  82. SyncTime xtime.Time `json:"synctime" gorm:"column:synctime"`
  83. Tags string `json:"tags" gorm:"-"`
  84. Timeline string `json:"timeline" gorm:"-"`
  85. CTime xtime.Time `json:"ctime" gorm:"column:ctime"`
  86. MTime xtime.Time `json:"mtime" gorm:"column:mtime"`
  87. }
  88. // TableName is used to identify table name in gorm
  89. func (CategoryList) TableName() string {
  90. return "music_with_category"
  91. }
  92. // CategoryListPager def.
  93. type CategoryListPager struct {
  94. Items []*CategoryList `json:"items"`
  95. Pager *Pager `json:"pager"`
  96. }