upper.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package model
  2. import "go-common/library/time"
  3. // Upper corresponds to the structure of upper in our DB
  4. type Upper struct {
  5. ID int `json:"id"`
  6. MID int64 `json:"mid" gorm:"column:mid"`
  7. State int `json:"state"`
  8. Toinit int `json:"toinit"`
  9. Retry int `json:"retry"`
  10. Deleted int `json:"deleted"`
  11. Ctime time.Time `json:"ctime"`
  12. Mtime time.Time `json:"mtime"`
  13. }
  14. // UpperR corresponds to the structure of upper to show in front-end
  15. type UpperR struct {
  16. MID int64 `json:"mid"`
  17. State int `json:"state"`
  18. Name string `json:"name"`
  19. Ctime string `json:"ctime"`
  20. Mtime string `json:"mtime"`
  21. }
  22. // UpperPager def.
  23. type UpperPager struct {
  24. Items []*UpperR `json:"items"`
  25. Page *Page `json:"page"`
  26. }
  27. // TableName ugc_uploader
  28. func (a Upper) TableName() string {
  29. return "ugc_uploader"
  30. }
  31. // ImportResp is for the response for import uppers' videos
  32. type ImportResp struct {
  33. NotExist []int64 `json:"not_exist"` // not existing uppers
  34. Succ []int64 `json:"succ"` // succesffuly updated ids
  35. }
  36. // ReqUpCms is the request structure of upcmsList
  37. type ReqUpCms struct {
  38. Order int `form:"order" validate:"required,min=3,max=4" default:"3"` // 3 = mtime Desc, 4 = mtime Asc
  39. Pn int `form:"pn" default:"1"`
  40. Name string `form:"name"`
  41. MID int64 `form:"mid"`
  42. Valid string `form:"valid"` // 0 = offline, 1 = online
  43. }
  44. // CmsUpper corresponds to the structure of upper for CMS in our DB
  45. type CmsUpper struct {
  46. MID int64 `json:"mid" gorm:"column:mid"`
  47. Mtime time.Time `json:"-"`
  48. MtimeStr string `json:"mtime" gorm:"-"`
  49. CmsName string `json:"cms_name"`
  50. OriName string `json:"ori_name"`
  51. CmsFace string `json:"cms_face"`
  52. Valid int `json:"valid"`
  53. }
  54. // ReqUpEdit is the request of up edit function
  55. type ReqUpEdit struct {
  56. MID int64 `form:"mid" validate:"required"`
  57. Name string `form:"name" validate:"required"`
  58. Face string `form:"face" validate:"required"`
  59. }
  60. // TableName ugc_uploader
  61. func (a CmsUpper) TableName() string {
  62. return "ugc_uploader"
  63. }
  64. // CmsUpperPager is cms upper pager
  65. type CmsUpperPager struct {
  66. Items []*CmsUpper `json:"items"`
  67. Page *Page `json:"page"`
  68. }
  69. // RespUpAudit is the response of up audit function
  70. type RespUpAudit struct {
  71. Succ []int64 `json:"succ"`
  72. Invalid []int64 `json:"invalid"`
  73. }
  74. // UpMC is upper info in MC
  75. type UpMC struct {
  76. ID int
  77. MID int64 `gorm:"column:mid"`
  78. Toinit int
  79. Submit int // 1=need report
  80. OriName string `gorm:"column:ori_name"` // original name
  81. CMSName string `gorm:"column:cms_name"` // cms intervened name
  82. OriFace string `gorm:"column:ori_face"` // original face
  83. CMSFace string `gorm:"column:cms_face"` // cms intervened face
  84. Valid int // auth info: 1=online,0=hidden
  85. Deleted int
  86. }
  87. // TableName ugc_uploader
  88. func (a UpMC) TableName() string {
  89. return "ugc_uploader"
  90. }