archive3.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package gorpc
  2. import (
  3. "context"
  4. "go-common/app/service/main/archive/api"
  5. model "go-common/app/service/main/archive/model/archive"
  6. )
  7. const (
  8. _archive3 = "RPC.Archive3"
  9. _archives3 = "RPC.Archives3"
  10. _view3 = "RPC.View3"
  11. _views3 = "RPC.Views3"
  12. _stat3 = "RPC.Stat3"
  13. _stats3 = "RPC.Stats3"
  14. _click3 = "RPC.Click3"
  15. _upArcs3 = "RPC.UpArcs3"
  16. _upsArcs3 = "RPC.UpsArcs3"
  17. _page3 = "RPC.Page3"
  18. _recommend3 = "RPC.Recommend3"
  19. _rankArcs3 = "RPC.RankArcs3"
  20. _ranksArcs3 = "RPC.RanksArcs3"
  21. _rankTopArcs3 = "RPC.RankTopArcs3"
  22. _rankAllArcs3 = "RPC.RankAllArcs3"
  23. _video3 = "RPC.Video3"
  24. _archivesWithPlayer = "RPC.ArchivesWithPlayer"
  25. _maxAid = "RPC.MaxAID"
  26. )
  27. // MaxAID get max aid
  28. func (s *Service2) MaxAID(c context.Context) (id int64, err error) {
  29. err = s.client.Call(c, _maxAid, _noArg, &id)
  30. return
  31. }
  32. // Archive3 Get receive aid, then init archive info.
  33. func (s *Service2) Archive3(c context.Context, arg *model.ArgAid2) (res *api.Arc, err error) {
  34. res = new(api.Arc)
  35. err = s.client.Call(c, _archive3, arg, res)
  36. return
  37. }
  38. // Archives3 receive aids, then init archives info.
  39. func (s *Service2) Archives3(c context.Context, arg *model.ArgAids2) (res map[int64]*api.Arc, err error) {
  40. err = s.client.Call(c, _archives3, arg, &res)
  41. return
  42. }
  43. // View3 get archive info and view pages.
  44. func (s *Service2) View3(c context.Context, arg *model.ArgAid2) (res *model.View3, err error) {
  45. res = new(model.View3)
  46. err = s.client.Call(c, _view3, arg, res)
  47. return
  48. }
  49. // Views3 get archives info and view pages.
  50. func (s *Service2) Views3(c context.Context, arg *model.ArgAids2) (res map[int64]*model.View3, err error) {
  51. err = s.client.Call(c, _views3, arg, &res)
  52. return
  53. }
  54. // Stat3 get archive stat
  55. func (s *Service2) Stat3(c context.Context, arg *model.ArgAid2) (res *api.Stat, err error) {
  56. err = s.client.Call(c, _stat3, arg, &res)
  57. return
  58. }
  59. // ArchivesWithPlayer archives witch player
  60. func (s *Service2) ArchivesWithPlayer(c context.Context, arg *model.ArgPlayer) (res map[int64]*model.ArchiveWithPlayer, err error) {
  61. err = s.client.Call(c, _archivesWithPlayer, arg, &res)
  62. return
  63. }
  64. // Stats3 get archive stat
  65. func (s *Service2) Stats3(c context.Context, arg *model.ArgAids2) (res map[int64]*api.Stat, err error) {
  66. err = s.client.Call(c, _stats3, arg, &res)
  67. return
  68. }
  69. // Click3 get archive click
  70. func (s *Service2) Click3(c context.Context, arg *model.ArgAid2) (res *api.Click, err error) {
  71. err = s.client.Call(c, _click3, arg, &res)
  72. return
  73. }
  74. // UpsArcs3 get archives of upper.
  75. func (s *Service2) UpsArcs3(c context.Context, arg *model.ArgUpsArcs2) (res map[int64][]*api.Arc, err error) {
  76. err = s.client.Call(c, _upsArcs3, arg, &res)
  77. return
  78. }
  79. // UpArcs3 get archives of upper.
  80. func (s *Service2) UpArcs3(c context.Context, arg *model.ArgUpArcs2) (res []*api.Arc, err error) {
  81. err = s.client.Call(c, _upArcs3, arg, &res)
  82. return
  83. }
  84. // Page3 get videos by aid
  85. func (s *Service2) Page3(c context.Context, arg *model.ArgAid2) (res []*api.Page, err error) {
  86. err = s.client.Call(c, _page3, arg, &res)
  87. return
  88. }
  89. // Recommend3 from archive_recommend by aid
  90. func (s *Service2) Recommend3(c context.Context, arg *model.ArgAid2) (res []*api.Arc, err error) {
  91. err = s.client.Call(c, _recommend3, arg, &res)
  92. return
  93. }
  94. // RankArcs3 get rank archives by type.
  95. func (s *Service2) RankArcs3(c context.Context, arg *model.ArgRank2) (res *model.RankArchives3, err error) {
  96. res = new(model.RankArchives3)
  97. err = s.client.Call(c, _rankArcs3, arg, res)
  98. return
  99. }
  100. // RanksArcs3 get rank archives by types.
  101. func (s *Service2) RanksArcs3(c context.Context, arg *model.ArgRanks2) (res map[int16]*model.RankArchives3, err error) {
  102. err = s.client.Call(c, _ranksArcs3, arg, &res)
  103. return
  104. }
  105. // RankTopArcs3 get top region archives by reid
  106. func (s *Service2) RankTopArcs3(c context.Context, arg *model.ArgRankTop2) (res []*api.Arc, err error) {
  107. err = s.client.Call(c, _rankTopArcs3, arg, &res)
  108. return
  109. }
  110. // RankAllArcs3 get left 7 days all archives
  111. func (s *Service2) RankAllArcs3(c context.Context, arg *model.ArgRankAll2) (res *model.RankArchives3, err error) {
  112. err = s.client.Call(c, _rankAllArcs3, arg, &res)
  113. return
  114. }
  115. // Video3 get video by aid & cid.
  116. func (s *Service2) Video3(c context.Context, arg *model.ArgVideo2) (res *api.Page, err error) {
  117. res = new(api.Page)
  118. err = s.client.Call(c, _video3, arg, res)
  119. return
  120. }