result.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package model
  2. import (
  3. "database/sql/driver"
  4. "time"
  5. )
  6. // Archive archive result
  7. type Archive struct {
  8. ID int64 `json:"id"`
  9. AID int64 `json:"aid"`
  10. Mid int64 `json:"mid"`
  11. TypeID int16 `json:"typeid"`
  12. Videos int `json:"videos"`
  13. Title string `json:"title"`
  14. Cover string `json:"cover"`
  15. Content string `json:"content"`
  16. Duration int `json:"duration"`
  17. Attribute int32 `json:"attribute"`
  18. Copyright int8 `json:"copyright"`
  19. Access int `json:"access"`
  20. PubTime wocaoTime `json:"pubtime"`
  21. CTime wocaoTime `json:"ctime"`
  22. MTime wocaoTime `json:"mtime"`
  23. State int `json:"state"`
  24. MissionID int64 `json:"mission_id"`
  25. OrderID int64 `json:"order_id"`
  26. RedirectURL string `json:"redirect_url"`
  27. Forward int64 `json:"forward"`
  28. Dynamic string `json:"dynamic"`
  29. }
  30. // Video is
  31. type Video struct {
  32. AID int64 `json:"aid"`
  33. CID int64 `json:"cid"`
  34. }
  35. type wocaoTime string
  36. // Scan scan time.
  37. func (jt *wocaoTime) Scan(src interface{}) (err error) {
  38. switch sc := src.(type) {
  39. case time.Time:
  40. *jt = wocaoTime(sc.Format("2006-01-02 15:04:05"))
  41. case string:
  42. *jt = wocaoTime(sc)
  43. }
  44. return
  45. }
  46. // Value get time value.
  47. func (jt wocaoTime) Value() (driver.Value, error) {
  48. return time.Parse("2006-01-02 15:04:05", string(jt))
  49. }