article.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package data
  2. import xtime "go-common/library/time"
  3. const (
  4. _ byte = iota
  5. //ArtView 阅读
  6. ArtView
  7. //ArtReply 评论
  8. ArtReply
  9. //ArtShare 分享
  10. ArtShare
  11. //ArtCoin 硬币
  12. ArtCoin
  13. //ArtFavTBL 收藏
  14. ArtFavTBL
  15. //ArtLikeTBL 喜欢
  16. ArtLikeTBL
  17. )
  18. var (
  19. artTypeMap = map[byte]struct{}{
  20. ArtView: {},
  21. ArtReply: {},
  22. ArtShare: {},
  23. ArtCoin: {},
  24. ArtFavTBL: {},
  25. ArtLikeTBL: {},
  26. }
  27. )
  28. //CheckType check article data type.
  29. func CheckType(ty byte) bool {
  30. _, ok := artTypeMap[ty]
  31. return ok
  32. }
  33. // ArtTrend for article trend.
  34. type ArtTrend struct {
  35. DateKey int64 `json:"date_key"`
  36. TotalIncr int64 `json:"total_inc"`
  37. }
  38. // ArtRankMap for article rank source.
  39. type ArtRankMap struct {
  40. AIDs map[int]int64
  41. Incrs map[int]int
  42. }
  43. // ArtRankList for article top 10 list.
  44. type ArtRankList struct {
  45. Arts []*ArtMeta `json:"art_rank"`
  46. }
  47. // ArtMeta for article rank meta data.
  48. type ArtMeta struct {
  49. AID int64 `json:"aid"`
  50. Incr int `json:"incr"`
  51. Title string `json:"title"`
  52. PTime xtime.Time `json:"ptime"`
  53. }
  54. // ArtRead for article read source.
  55. type ArtRead struct {
  56. Source map[string]int `family:"f" json:"source"`
  57. }