bnj.go 784 B

12345678910111213141516171819202122232425262728293031323334
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/job/main/dm2/model"
  5. "go-common/library/log"
  6. "go-common/library/net/metadata"
  7. )
  8. const (
  9. _bnjLiveConfig = "/activity/v0/bainian/config"
  10. )
  11. func (d *Dao) bnjConfigURI() string {
  12. return d.conf.Host.APILive + _bnjLiveConfig
  13. }
  14. // BnjConfig .
  15. func (d *Dao) BnjConfig(c context.Context) (bnjConfig *model.BnjLiveConfig, err error) {
  16. var (
  17. res struct {
  18. Code int64 `json:"code"`
  19. Message string `json:"message"`
  20. Data *model.BnjLiveConfig `json:"data"`
  21. }
  22. )
  23. if err = d.httpCli.Get(c, d.bnjConfigURI(), metadata.String(c, metadata.RemoteIP), nil, &res); err != nil {
  24. log.Error("bnjLiveConfig BnjConfig(url:%v) error(%v)", d.bnjConfigURI(), err)
  25. return
  26. }
  27. bnjConfig = res.Data
  28. return
  29. }