auth.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package model
  2. const (
  3. _epPass = 3
  4. _epRejected = 4
  5. _noMarkWhiteList = 1
  6. )
  7. // EpAuth is the structure of ep in mc
  8. type EpAuth struct {
  9. ID int64 `json:"id"`
  10. EPID int64 `json:"epid"`
  11. SeasonID int64 `json:"season_id"`
  12. State int `json:"state"`
  13. Valid int `json:"valid"`
  14. IsDeleted int `json:"is_deleted"`
  15. NoMark int `json:"no_mark"`
  16. }
  17. // SnAuth is the structure of season in mc
  18. type SnAuth struct {
  19. ID int64 `json:"id"`
  20. IsDeleted int8 `json:"is_deleted"`
  21. Valid int `json:"valid"`
  22. Check int8 `json:"check"`
  23. }
  24. // NotDeleted def.
  25. func (s SnAuth) NotDeleted() bool {
  26. return s.IsDeleted == 0
  27. }
  28. // NotDeleted def.
  29. func (s EpAuth) NotDeleted() bool {
  30. return s.IsDeleted == 0
  31. }
  32. // CanPlay returns whether the season is able to play
  33. func (s EpAuth) CanPlay() bool {
  34. return s.IsDeleted == 0 && s.Valid == 1 && s.State == 3
  35. }
  36. // Auditing checks whether the ep is still auditing
  37. // func (s EpAuth) Auditing() bool {
  38. // return s.State != _epPass && s.State != _epRejected && s.IsDeleted == _noDel
  39. // }
  40. // Whitelist checks whether the ep is in the whitelist of no mark eps
  41. func (s EpAuth) Whitelist() bool {
  42. return s.NoMark == _noMarkWhiteList
  43. }
  44. // CanPlay returns whether the season is able to play
  45. func (s SnAuth) CanPlay() bool {
  46. return s.IsDeleted == 0 && s.Valid == 1 && s.Check == 1
  47. }
  48. // ArcType def.
  49. type ArcType struct {
  50. ID int32 `json:"id"`
  51. Name string `json:"name"`
  52. }