pgc_cond.go 635 B

12345678910111213141516171819202122232425262728293031
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "net/url"
  6. "go-common/app/admin/main/tv/model"
  7. "go-common/library/ecode"
  8. "github.com/pkg/errors"
  9. )
  10. // PgcCond picks pgc condition
  11. func (d *Dao) PgcCond(c context.Context, snType int32) (result *model.PgcCond, err error) {
  12. var (
  13. host = d.c.Cfg.RefLabel.PgcAPI
  14. params = url.Values{}
  15. resp = model.PgcCondResp{}
  16. )
  17. params.Set("season_type", fmt.Sprintf("%d", snType))
  18. if err = d.client.Get(c, host, "", params, &resp); err != nil {
  19. return
  20. }
  21. if resp.Code != ecode.OK.Code() {
  22. err = errors.Wrapf(ecode.Int(resp.Code), resp.Message)
  23. return
  24. }
  25. result = resp.Result
  26. return
  27. }