archive.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package archive
  2. import (
  3. "go-common/library/time"
  4. )
  5. // Archive is archive model.
  6. type Archive struct {
  7. Aid int64 `json:"aid"`
  8. Mid int64 `json:"mid"`
  9. TypeID int16 `json:"tid"`
  10. HumanRank int `json:"-"`
  11. Title string `json:"title"`
  12. Author string `json:"-"`
  13. Cover string `json:"cover"`
  14. RejectReason string `json:"reject_reason"`
  15. Tag string `json:"tag"`
  16. Duration int64 `json:"duration"`
  17. Copyright int8 `json:"copyright"`
  18. Desc string `json:"desc"`
  19. MissionID int64 `json:"mission_id"`
  20. Round int8 `json:"-"`
  21. Forward int64 `json:"-"`
  22. Attribute int32 `json:"attribute"`
  23. Access int16 `json:"-"`
  24. State int8 `json:"state"`
  25. Source string `json:"source"`
  26. NoReprint int32 `json:"no_reprint"`
  27. UGCPay int32 `json:"ugcpay"`
  28. OrderID int64 `json:"order_id"`
  29. UpFrom int8 `json:"up_from"`
  30. Dynamic string `json:"dynamic"`
  31. DescFormatID int64 `json:"desc_format_id"`
  32. Porder *Porder `json:"porder"`
  33. Staffs []*StaffApply `json:"staffs"`
  34. POI *PoiObj `json:"poi_object"`
  35. Vote *Vote `json:"vote"`
  36. DTime time.Time `json:"dtime"`
  37. PTime time.Time `json:"ptime"`
  38. CTime time.Time `json:"ctime"`
  39. MTime time.Time `json:"mtime"`
  40. }
  41. // AttrSet set attribute.
  42. func (a *Archive) AttrSet(v int32, bit uint) {
  43. a.Attribute = a.Attribute&(^(1 << bit)) | (v << bit)
  44. }
  45. // AttrVal get attribute.
  46. func (a *Archive) AttrVal(bit uint) int32 {
  47. return (a.Attribute >> bit) & int32(1)
  48. }
  49. // NotAllowUp check archive is or not allow update state.
  50. func (a *Archive) NotAllowUp() bool {
  51. return a.State == StateForbidUpDelete || a.State == StateForbidLock || a.State == StateForbidPolice
  52. }
  53. // SimpleArchive str
  54. type SimpleArchive struct {
  55. Aid int64 `json:"aid"`
  56. Title string `json:"title"`
  57. Mid int64 `json:"mid"`
  58. Videos []*Video `json:"videos,omitempty"`
  59. }
  60. // Addit str
  61. type Addit struct {
  62. Aid int64 `json:"aid"`
  63. MissionID int64 `json:"mission_id"`
  64. UpFrom int8 `json:"up_from"`
  65. FromIP int64 `json:"from_ip"`
  66. IPv6 []byte `json:"ipv6"`
  67. Source string `json:"source"`
  68. OrderID int64 `json:"order_id"`
  69. RecheckReason string `json:"recheck_reason"`
  70. RedirectURL string `json:"redirect_url"`
  71. FlowID int64 `json:"flow_id"`
  72. Advertiser string `json:"advertiser"`
  73. FlowRemark string `json:"flow_remark"`
  74. DescFormatID int64 `json:"desc_format_id"`
  75. Desc string `json:"desc"`
  76. Dynamic string `json:"dynamic"`
  77. }
  78. // Delay str
  79. type Delay struct {
  80. Aid int64
  81. State int8
  82. DTime time.Time
  83. }
  84. // Type info
  85. type Type struct {
  86. ID int16 `json:"id"`
  87. PID int16 `json:"pid"`
  88. Name string `json:"name"`
  89. Desc string `json:"description"`
  90. }
  91. // Alert str
  92. type Alert struct {
  93. Key string
  94. Value int64
  95. Limit int64
  96. }
  97. // Up str
  98. type Up struct {
  99. ID int64 `json:"id"`
  100. GroupID int64 `json:"group_id"`
  101. GroupName string `json:"group_name" `
  102. GroupTag string `json:"group_tag"`
  103. Mid int64 `json:"mid"`
  104. Note string `json:"note"`
  105. CTime time.Time `json:"ctime"`
  106. }