databus.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package pgc
  2. // MediaEP is the new structure of ep in Databus Msg
  3. type MediaEP struct {
  4. ID int64 `json:"id"`
  5. EPID int `json:"epid"`
  6. SeasonID int `json:"season_id"`
  7. State int `json:"state"`
  8. Valid int `json:"valid"`
  9. IsDeleted int `json:"is_deleted"`
  10. Title string `json:"title"`
  11. Subtitle string `json:"subtitle"`
  12. Cover string `json:"cover"`
  13. Mark int `json:"mark"`
  14. CID int64 `json:"cid"`
  15. PayStatus int `json:"pay_status"`
  16. }
  17. // MediaSn is the new structure of season in Databus Msg
  18. type MediaSn struct {
  19. ID int64 `json:"id"`
  20. IsDeleted int8 `json:"is_deleted"`
  21. Valid int `json:"valid"`
  22. Check int8 `json:"check"`
  23. Title string `json:"title"`
  24. Cover string `json:"cover"`
  25. Desc string `json:"desc"`
  26. UpInfo string `json:"upinfo"`
  27. Ctime string `json:"ctime"`
  28. Category int `json:"category"`
  29. Area string `json:"area"`
  30. Playtime string `json:"play_time"`
  31. Role string `json:"role"`
  32. Staff string `json:"staff"`
  33. TotalNum int `json:"total_num"`
  34. Style string `json:"style"`
  35. Producer string `json:"producer"`
  36. Version string `json:"version"`
  37. AliasSearch string `json:"alias_search"`
  38. Brief string `json:"brief"`
  39. Status int `json:"status"`
  40. }
  41. // DatabusRes is the result of databus message
  42. type DatabusRes struct {
  43. Action string `json:"action"`
  44. Table string `json:"table"`
  45. }
  46. // DatabusEP is the struct of message for the modification of tv_content
  47. type DatabusEP struct {
  48. New *MediaEP `json:"new"`
  49. Old *MediaEP `json:"old"`
  50. }
  51. // DatabusSeason is the struct of message for the modification of tv_ep_season
  52. type DatabusSeason struct {
  53. Old *MediaSn `json:"old"`
  54. New *MediaSn `json:"new"`
  55. }
  56. // ToSimple returns SimpleSeason struct
  57. func (m *MediaSn) ToSimple() *SimpleSeason {
  58. return &SimpleSeason{
  59. ID: m.ID,
  60. IsDeleted: m.IsDeleted,
  61. Valid: m.Valid,
  62. Check: m.Check,
  63. }
  64. }
  65. // ToSimple returns SimpleEP struct
  66. func (ep *MediaEP) ToSimple() *SimpleEP {
  67. return &SimpleEP{
  68. ID: ep.ID,
  69. IsDeleted: ep.IsDeleted,
  70. Valid: ep.Valid,
  71. State: ep.State,
  72. SeasonID: ep.SeasonID,
  73. EPID: ep.EPID,
  74. NoMark: ep.Mark,
  75. }
  76. }
  77. // ToCMS returns EpCMS
  78. func (ep *MediaEP) ToCMS() *EpCMS {
  79. return &EpCMS{
  80. EPID: int(ep.EPID),
  81. Cover: ep.Cover,
  82. Title: ep.Title,
  83. Subtitle: ep.Subtitle,
  84. PayStatus: ep.PayStatus,
  85. }
  86. }