elec.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package service
  2. import (
  3. "context"
  4. apihttp "go-common/app/interface/main/ugcpay-rank/api/http"
  5. apirpc "go-common/app/service/main/ugcpay-rank/api/v1"
  6. )
  7. // RankElecMonthUP .
  8. func (s *Service) RankElecMonthUP(ctx context.Context, upMID int64, rankSize int) (rank *apihttp.RespRankElecMonthUP, err error) {
  9. var (
  10. resp *apirpc.RankElecUPResp
  11. )
  12. if resp, err = s.dao.RankElecMonthUP(ctx, upMID, rankSize); err != nil {
  13. return
  14. }
  15. rank = &apihttp.RespRankElecMonthUP{}
  16. rank.Parse(resp.UP)
  17. return
  18. }
  19. // RankElecMonth .
  20. func (s *Service) RankElecMonth(ctx context.Context, upMID, avID int64, rankSize int) (rank *apihttp.RespRankElecMonth, err error) {
  21. var (
  22. resp *apirpc.RankElecMonthResp
  23. )
  24. if resp, err = s.dao.RankElecMonth(ctx, avID, upMID, rankSize); err != nil {
  25. return
  26. }
  27. rank = &apihttp.RespRankElecMonth{}
  28. rank.Parse(resp.AV, resp.UP)
  29. return
  30. }
  31. // RankElecAllAV .
  32. func (s *Service) RankElecAllAV(ctx context.Context, upMID int64, avID int64, rankSize int) (rank *apihttp.RespRankElecAllAV, err error) {
  33. var (
  34. resp *apirpc.RankElecAVResp
  35. )
  36. if resp, err = s.dao.RankElecAllAV(ctx, upMID, avID, rankSize); err != nil {
  37. return
  38. }
  39. rank = &apihttp.RespRankElecAllAV{}
  40. rank.Parse(resp.AV)
  41. return
  42. }