rank.go 504 B

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