archive.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. package data
  2. import "go-common/app/interface/main/creative/model/archive"
  3. // ArchiveStat for archive stat.
  4. type ArchiveStat struct {
  5. Play int64 `json:"play"`
  6. Dm int64 `json:"dm"`
  7. Reply int64 `json:"reply"`
  8. Like int64 `json:"like"`
  9. Coin int64 `json:"coin"`
  10. Elec int64 `json:"elec"`
  11. Fav int64 `json:"fav"`
  12. Share int64 `json:"share"`
  13. }
  14. // ArchiveSource for archive source
  15. type ArchiveSource struct {
  16. Mainsite int64 `json:"mainsite"`
  17. Outsite int64 `json:"outsite"`
  18. Mobile int64 `json:"mobile"`
  19. Others int64 `json:"others"`
  20. WebPC int64 `json:"-"`
  21. WebH5 int64 `json:"-"`
  22. IOS int64 `json:"-"`
  23. Android int64 `json:"-"`
  24. }
  25. // ArchiveGroup for archive group.
  26. type ArchiveGroup struct {
  27. Fans int64 `json:"fans"`
  28. Guest int64 `json:"guest"`
  29. }
  30. // ArchiveArea for archive area.
  31. type ArchiveArea struct {
  32. Location string `json:"location"`
  33. Count int64 `json:"count"`
  34. }
  35. // ArchiveData for single archive stats.
  36. type ArchiveData struct {
  37. ArchiveStat *ArchiveStat `json:"stat"`
  38. ArchiveSource *ArchiveSource `json:"source"`
  39. ArchiveGroup *ArchiveGroup `json:"group"`
  40. ArchivePlay *ArchivePlay `json:"play"`
  41. ArchiveAreas []*ArchiveArea `json:"area"`
  42. Videos []*archive.SimpleVideo `json:"videos,omitempty"`
  43. }
  44. // UpBaseStat for up base.
  45. type UpBaseStat struct {
  46. View int64 `json:"view"`
  47. Reply int64 `json:"reply"`
  48. Dm int64 `json:"dm"`
  49. Fans int64 `json:"fans"`
  50. Fav int64 `json:"fav"`
  51. Like int64 `json:"like"`
  52. Share int64 `json:"share"`
  53. Coin int64 `json:"coin"`
  54. Elec int64 `json:"elec"`
  55. }
  56. // ViewerBase for up base data analysis.
  57. type ViewerBase struct {
  58. Male int64 `json:"male"`
  59. Female int64 `json:"female"`
  60. AgeOne int64 `json:"age_one"`
  61. AgeTwo int64 `json:"age_two"`
  62. AgeThree int64 `json:"age_three"`
  63. AgeFour int64 `json:"age_four"`
  64. PlatPC int64 `json:"plat_pc"`
  65. PlatH5 int64 `json:"plat_h5"`
  66. PlatOut int64 `json:"plat_out"`
  67. PlatIOS int64 `json:"plat_ios"`
  68. PlatAndroid int64 `json:"plat_android"`
  69. PlatOtherApp int64 `json:"plat_other_app"`
  70. }
  71. // ViewerActionHour for up action data analysis.
  72. type ViewerActionHour struct {
  73. View map[int]int `json:"view"`
  74. Reply map[int]int `json:"reply"`
  75. Dm map[int]int `json:"danmu"`
  76. Elec map[int]int `json:"elec"`
  77. Contract map[int]int `json:"contract"`
  78. }
  79. // Trend for up trend data analysis.
  80. type Trend struct {
  81. Ty map[int]int64
  82. Tag map[int]int64
  83. }
  84. // UpDataIncrMeta for Play/Dm/Reply/Fav/Share/Elec/Coin incr.
  85. type UpDataIncrMeta struct {
  86. Incr int `json:"-"`
  87. TopAIDList map[int]int64 `json:"-"`
  88. TopIncrList map[int]int `json:"-"`
  89. Rank map[int]int `json:"-"`
  90. TyRank map[string]int `json:"-"`
  91. }
  92. const (
  93. //Play 播放相关.
  94. Play = int8(1)
  95. //Dm 弹幕相关.
  96. Dm = int8(2)
  97. //Reply 评论相关.
  98. Reply = int8(3)
  99. //Share 分享相关.
  100. Share = int8(4)
  101. //Coin 投币相关.
  102. Coin = int8(5)
  103. //Fav 收藏相关.
  104. Fav = int8(6)
  105. //Elec 充电相关.
  106. Elec = int8(7)
  107. //Like 点赞相关.
  108. Like = int8(8)
  109. )
  110. var (
  111. typeNameMap = map[int8]string{
  112. Play: "play",
  113. Dm: "dm",
  114. Reply: "reply",
  115. Share: "share",
  116. Coin: "coin",
  117. Fav: "fav",
  118. Elec: "elec",
  119. Like: "like",
  120. }
  121. )
  122. //IncrTy return incr data type.
  123. func IncrTy(ty int8) (val string, ok bool) {
  124. val, ok = typeNameMap[ty]
  125. return
  126. }
  127. // ArchiveMaxStat 获取单个稿件最多播放、评论、弹幕。。。
  128. type ArchiveMaxStat struct {
  129. PlayV int64 `family:"f" qualifier:"play_v" json:"play_v"`
  130. PlayA int64 `family:"f" qualifier:"play_a" json:"play_a"`
  131. CoinV int64 `family:"f" qualifier:"coin_v" json:"coin_v"`
  132. CoinA int64 `family:"f" qualifier:"coin_a" json:"coin_a"`
  133. LikeV int64 `family:"f" qualifier:"like_v" json:"like_v"`
  134. LikeA int64 `family:"f" qualifier:"like_a" json:"like_a"`
  135. ReplyV int64 `family:"f" qualifier:"reply_v" json:"reply_v"`
  136. ReplyA int64 `family:"f" qualifier:"reply_a" json:"reply_a"`
  137. ShareV int64 `family:"f" qualifier:"share_v" json:"share_v"`
  138. ShareA int64 `family:"f" qualifier:"share_a" json:"share_a"`
  139. FavV int64 `family:"f" qualifier:"fav_v" json:"fav_v"`
  140. FavA int64 `family:"f" qualifier:"fav_a" json:"fav_a"`
  141. DmV int64 `family:"f" qualifier:"dm_v" json:"dm_v"`
  142. DmA int64 `family:"f" qualifier:"dm_a" json:"dm_a"`
  143. FromPhoneNum int64 `family:"f" qualifier:"from_phone_num" json:"from_phone_num"`
  144. }