protect.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package model
  2. import (
  3. "time"
  4. )
  5. const (
  6. // ProtectApplyLimit protect apply limit
  7. ProtectApplyLimit = 20
  8. )
  9. // Pager comment
  10. type Pager struct {
  11. Total int `json:"total"`
  12. Current int `json:"current"`
  13. Size int `json:"size"`
  14. TotalCount int `json:"total_count"`
  15. }
  16. // Pa 保护弹幕
  17. type Pa struct {
  18. ID int64
  19. CID int64
  20. UID int64
  21. ApplyUID int64
  22. AID int64
  23. Playtime float32
  24. DMID int64
  25. Msg string
  26. Status int
  27. Ctime time.Time
  28. Mtime time.Time
  29. }
  30. // Apply apply protect dm
  31. type Apply struct {
  32. ID int64 `json:"id"`
  33. AID int64 `json:"aid"`
  34. CID int64 `json:"cid"`
  35. Title string `json:"title"`
  36. ApplyUID int64 `json:"-"`
  37. Pic string `json:"pic"`
  38. Uname string `json:"uname"`
  39. Msg string `json:"msg"`
  40. Playtime float32 `json:"playtime"`
  41. Ctime string `json:"ctime"`
  42. }
  43. // ApplySortPlaytime what
  44. type ApplySortPlaytime []*Apply
  45. func (c ApplySortPlaytime) Len() int {
  46. return len(c)
  47. }
  48. func (c ApplySortPlaytime) Swap(i, j int) {
  49. c[i], c[j] = c[j], c[i]
  50. }
  51. func (c ApplySortPlaytime) Less(i, j int) bool {
  52. if c[i].CID == c[j].CID {
  53. return c[i].Playtime < c[j].Playtime
  54. }
  55. return c[i].CID > c[j].CID
  56. }
  57. // ApplySortID what
  58. type ApplySortID []*Apply
  59. // Len get len
  60. func (c ApplySortID) Len() int {
  61. return len(c)
  62. }
  63. // Swap change dm
  64. func (c ApplySortID) Swap(i, j int) {
  65. c[i], c[j] = c[j], c[i]
  66. }
  67. // Less count
  68. func (c ApplySortID) Less(i, j int) bool {
  69. return c[i].ID > c[j].ID
  70. }
  71. // ApplyListResult get
  72. type ApplyListResult struct {
  73. Pager *Pager
  74. List []*Apply
  75. }
  76. // Video video info
  77. type Video struct {
  78. Aid int64 `json:"aid"`
  79. Title string `json:"title"`
  80. }
  81. // ApplyUserStat user stat
  82. type ApplyUserStat struct {
  83. Aid int64
  84. UID int64
  85. Status int
  86. Ctime time.Time
  87. }
  88. // ApplyUserNotify user notify
  89. type ApplyUserNotify struct {
  90. Title string
  91. Aid int64
  92. Protect int
  93. Unprotect int
  94. }