model.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package model
  2. import (
  3. "encoding/json"
  4. "go-common/library/time"
  5. )
  6. // 接口Action定义
  7. const (
  8. ActionRecommend = iota
  9. ActionPlay
  10. ActionLike
  11. ActionCancelLike
  12. ActionFollow
  13. ActionCancelFollow
  14. ActionCommentAdd
  15. ActionCommentLike
  16. ActionCommentReport
  17. ActionFeedList
  18. ActionShare
  19. ActionDanmaku
  20. ActionPlayPause
  21. ActionPushRegister
  22. ActionPushSucced
  23. ActionPushCallback
  24. ActionBlack
  25. ActionCancelBlack
  26. ActionVideoSearch
  27. ActionUserSearch
  28. ActionUserUnLike
  29. )
  30. // App platform
  31. const (
  32. PlatAndroid = iota + 1
  33. PlatIOS
  34. )
  35. const (
  36. // FeedListLen 为feed list中返回的数量
  37. FeedListLen = 10
  38. // SpaceListLen 空间长度
  39. SpaceListLen = 20
  40. // MaxInt64 用于最大int64
  41. MaxInt64 = int64(^uint64(0) >> 1)
  42. // BatchUserLen 批量请求用户信息时最大数量
  43. BatchUserLen = 50
  44. )
  45. const (
  46. //FromBILI video.from bilibili
  47. FromBILI = 0
  48. //FromBBQ video.from bbq
  49. FromBBQ = 1
  50. //FromCMS video.from cms
  51. FromCMS = 2
  52. )
  53. // FeedMark record the struct which returned to app in feed api
  54. type FeedMark struct {
  55. LastSvID int64 `json:"last_svid"`
  56. LastPubtime time.Time `json:"last_pubtime"`
  57. IsRec bool `json:"is_rec"`
  58. }
  59. // CursorValue 用于cursor的定位,这里可以当做通用结构使用,使用者自己根据需求定义cursor_id的含义
  60. type CursorValue struct {
  61. CursorID int64 `json:"cursor_id"`
  62. CursorTime time.Time `json:"cursor_time"`
  63. }
  64. //HTTPRpcRes ..
  65. type HTTPRpcRes struct {
  66. Code int `json:"code"`
  67. Msg string `json:"message"`
  68. Data json.RawMessage `json:"data"`
  69. }