player.go 784 B

123456789101112131415161718192021222324252627282930
  1. package feed
  2. import (
  3. "context"
  4. "go-common/app/service/main/archive/model/archive"
  5. "go-common/library/log"
  6. )
  7. // ArchivesWithPlayer archives witch player
  8. func (s *Service) ArchivesWithPlayer(c context.Context, aids []int64, qn int, platform string, fnver, fnval, forceHost, build int) (res map[int64]*archive.ArchiveWithPlayer, err error) {
  9. if res, err = s.arc.ArchivesWithPlayer(c, aids, qn, platform, fnver, fnval, forceHost, build); err != nil {
  10. log.Error("%+v", err)
  11. }
  12. if len(res) != 0 {
  13. return
  14. }
  15. am, err := s.arc.Archives(c, aids)
  16. if err != nil {
  17. return
  18. }
  19. if len(am) == 0 {
  20. return
  21. }
  22. res = make(map[int64]*archive.ArchiveWithPlayer, len(am))
  23. for aid, a := range am {
  24. res[aid] = &archive.ArchiveWithPlayer{Archive3: archive.BuildArchive3(a)}
  25. }
  26. return
  27. }