rank.go 520 B

1234567891011121314151617181920212223242526
  1. package feed
  2. import (
  3. "go-common/app/interface/main/app-card/model/card/rank"
  4. "go-common/app/interface/main/app-intl/model"
  5. )
  6. // RankCard is.
  7. func (s *Service) RankCard(plat int8) (ranks []*rank.Rank, aids []int64) {
  8. var limit int
  9. if !model.IsIPad(plat) {
  10. limit = 3
  11. } else {
  12. limit = 4
  13. }
  14. ranks = make([]*rank.Rank, 0, limit)
  15. aids = make([]int64, 0, limit)
  16. for _, rank := range s.rankCache {
  17. ranks = append(ranks, rank)
  18. aids = append(aids, rank.Aid)
  19. if len(ranks) == limit {
  20. break
  21. }
  22. }
  23. return
  24. }