uplayurl.go 643 B

12345678910111213141516171819202122232425262728
  1. package service
  2. import (
  3. "fmt"
  4. "go-common/app/admin/main/tv/model"
  5. "go-common/library/log"
  6. )
  7. // UPlayurl get ugc play url
  8. func (s *Service) UPlayurl(aid int) (playurl string, err error) {
  9. w := map[string]interface{}{
  10. "deleted": 0,
  11. "result": 1,
  12. "cid": aid,
  13. }
  14. video := model.Video{}
  15. if err = s.dao.DB.Model(&model.Video{}).Where(w).First(&video).Error; err != nil {
  16. err = fmt.Errorf("找不到aid为%d的数据", aid)
  17. return
  18. }
  19. if playurl, err = s.dao.UPlayurl(ctx, aid); err != nil {
  20. log.Error("UPlayurl API Error(%d) (%v)", aid, err)
  21. return
  22. }
  23. log.Info("UPlayurl aid = %d, playurl = %s", aid, playurl)
  24. return
  25. }