data.go 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/main/mcn/model"
  5. "go-common/app/interface/main/mcn/model/datamodel"
  6. "go-common/app/interface/main/mcn/model/mcnmodel"
  7. "go-common/library/ecode"
  8. "go-common/library/log"
  9. )
  10. //GetMcnGetIndexInc .
  11. func (s *Service) GetMcnGetIndexInc(c context.Context, arg *mcnmodel.McnGetIndexIncReq) (res *mcnmodel.McnGetIndexIncReply, err error) {
  12. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  13. if err != nil {
  14. if err != ecode.NothingFound {
  15. log.Error("error get state, err=%s", err)
  16. }
  17. return
  18. }
  19. if res, err = s.datadao.GetIndexIncCache(c, mcnSign.ID, datamodel.GetLastDay(), arg.Type); err != nil {
  20. log.Error("get data fail, err=%v", err)
  21. return
  22. }
  23. return
  24. }
  25. // GetMcnGetIndexSource .
  26. func (s *Service) GetMcnGetIndexSource(c context.Context, arg *mcnmodel.McnGetIndexSourceReq) (res *mcnmodel.McnGetIndexSourceReply, err error) {
  27. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  28. if err != nil {
  29. if err != ecode.NothingFound {
  30. log.Error("error get state, err=%s", err)
  31. }
  32. return
  33. }
  34. if res, err = s.datadao.GetIndexSourceCache(c, mcnSign.ID, datamodel.GetLastDay(), arg.Type); err != nil {
  35. log.Error("get data fail, err=%v", err)
  36. return
  37. }
  38. return
  39. }
  40. // GetPlaySource .
  41. func (s *Service) GetPlaySource(c context.Context, arg *mcnmodel.McnGetPlaySourceReq) (res *mcnmodel.McnGetPlaySourceReply, err error) {
  42. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  43. if err != nil {
  44. if err != ecode.NothingFound {
  45. log.Error("error get state, err=%s", err)
  46. }
  47. return
  48. }
  49. if res, err = s.datadao.GetPlaySourceCache(c, mcnSign.ID, datamodel.GetLastDay()); err != nil {
  50. log.Error("get data fail, err=%v", err)
  51. }
  52. return
  53. }
  54. // GetMcnFans .
  55. func (s *Service) GetMcnFans(c context.Context, arg *mcnmodel.McnGetMcnFansReq) (res *mcnmodel.McnGetMcnFansReply, err error) {
  56. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  57. if err != nil {
  58. if err != ecode.NothingFound {
  59. log.Error("error get state, err=%s", err)
  60. }
  61. return
  62. }
  63. if res, err = s.datadao.GetMcnFansCache(c, mcnSign.ID, datamodel.GetLastDay()); err != nil {
  64. log.Error("get data fail, err=%v", err)
  65. }
  66. return
  67. }
  68. // GetMcnFansInc .
  69. func (s *Service) GetMcnFansInc(c context.Context, arg *mcnmodel.McnGetMcnFansIncReq) (res *mcnmodel.McnGetMcnFansIncReply, err error) {
  70. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  71. if err != nil {
  72. if err != ecode.NothingFound {
  73. log.Error("error get state, err=%s", err)
  74. }
  75. return
  76. }
  77. if res, err = s.datadao.GetMcnFansIncCache(c, mcnSign.ID, datamodel.GetLastDay()); err != nil {
  78. log.Error("get data fail, err=%v", err)
  79. }
  80. return
  81. }
  82. // GetMcnFansDec .
  83. func (s *Service) GetMcnFansDec(c context.Context, arg *mcnmodel.McnGetMcnFansDecReq) (res *mcnmodel.McnGetMcnFansDecReply, err error) {
  84. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  85. if err != nil {
  86. if err != ecode.NothingFound {
  87. log.Error("error get state, err=%s", err)
  88. }
  89. return
  90. }
  91. if res, err = s.datadao.GetMcnFansDecCache(c, mcnSign.ID, datamodel.GetLastDay()); err != nil {
  92. log.Error("get data fail, err=%v", err)
  93. }
  94. return
  95. }
  96. // GetMcnFansAttentionWay .
  97. func (s *Service) GetMcnFansAttentionWay(c context.Context, arg *mcnmodel.McnGetMcnFansAttentionWayReq) (res *mcnmodel.McnGetMcnFansAttentionWayReply, err error) {
  98. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  99. if err != nil {
  100. if err != ecode.NothingFound {
  101. log.Error("error get state, err=%s", err)
  102. }
  103. return
  104. }
  105. if res, err = s.datadao.GetMcnFansAttentionWayCache(c, mcnSign.ID, datamodel.GetLastDay()); err != nil {
  106. log.Error("get data fail, err=%v", err)
  107. }
  108. return
  109. }
  110. // GetBaseFansAttrReq .
  111. func (s *Service) GetBaseFansAttrReq(c context.Context, arg *mcnmodel.McnGetBaseFansAttrReq) (res *mcnmodel.McnGetBaseFansAttrReply, err error) {
  112. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  113. if err != nil {
  114. if err != ecode.NothingFound {
  115. log.Error("error get state, err=%s", err)
  116. }
  117. return
  118. }
  119. if res, err = s.datadao.GetFansBaseFansAttrCache(c, mcnSign.ID, datamodel.GetLastWeek(), arg.UserType); err != nil {
  120. log.Error("get data fail, err=%v", err)
  121. }
  122. return
  123. }
  124. // GetFansArea .
  125. func (s *Service) GetFansArea(c context.Context, arg *mcnmodel.McnGetFansAreaReq) (res *mcnmodel.McnGetFansAreaReply, err error) {
  126. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  127. if err != nil {
  128. if err != ecode.NothingFound {
  129. log.Error("error get state, err=%s", err)
  130. }
  131. return
  132. }
  133. if res, err = s.datadao.GetFansAreaCache(c, mcnSign.ID, datamodel.GetLastWeek(), arg.UserType); err != nil {
  134. log.Error("get data fail, err=%v", err)
  135. }
  136. return
  137. }
  138. // GetFansType .
  139. func (s *Service) GetFansType(c context.Context, arg *mcnmodel.McnGetFansTypeReq) (res *mcnmodel.McnGetFansTypeReply, err error) {
  140. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  141. if err != nil {
  142. if err != ecode.NothingFound {
  143. log.Error("error get state, err=%s", err)
  144. }
  145. return
  146. }
  147. if res, err = s.datadao.GetFansTypeCache(c, mcnSign.ID, datamodel.GetLastWeek(), arg.UserType); err != nil {
  148. log.Error("get data fail, err=%v", err)
  149. }
  150. return
  151. }
  152. // GetFansTag .
  153. func (s *Service) GetFansTag(c context.Context, arg *mcnmodel.McnGetFansTagReq) (res *mcnmodel.McnGetFansTagReply, err error) {
  154. mcnSign, err := s.getMcnWithState(c, arg.McnMid, model.MCNSignStateOnSign)
  155. if err != nil {
  156. if err != ecode.NothingFound {
  157. log.Error("error get state, err=%s", err)
  158. }
  159. return
  160. }
  161. if res, err = s.datadao.GetFansTagCache(c, mcnSign.ID, datamodel.GetLastWeek(), arg.UserType); err != nil {
  162. log.Error("get data fail, err=%v", err)
  163. }
  164. return
  165. }