common.go 951 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package common
  2. import (
  3. "go-common/app/admin/main/feed/conf"
  4. accdao "go-common/app/admin/main/feed/dao/account"
  5. arcdao "go-common/app/admin/main/feed/dao/archive"
  6. pgcdao "go-common/app/admin/main/feed/dao/pgc"
  7. showdao "go-common/app/admin/main/feed/dao/show"
  8. "go-common/library/log"
  9. httpx "go-common/library/net/http/blademaster"
  10. )
  11. // Service is search service
  12. type Service struct {
  13. showDao *showdao.Dao
  14. pgcDao *pgcdao.Dao
  15. accDao *accdao.Dao
  16. arcDao *arcdao.Dao
  17. client *httpx.Client
  18. managerURL string
  19. }
  20. // New new a search service
  21. func New(c *conf.Config) (s *Service) {
  22. var (
  23. pgc *pgcdao.Dao
  24. err error
  25. )
  26. if pgc, err = pgcdao.New(c); err != nil {
  27. log.Error("pgcdao.New error(%v)", err)
  28. return
  29. }
  30. s = &Service{
  31. showDao: showdao.New(c),
  32. pgcDao: pgc,
  33. accDao: accdao.New(c),
  34. arcDao: arcdao.New(c),
  35. client: httpx.NewClient(c.HTTPClient),
  36. managerURL: c.Host.Manager,
  37. }
  38. return
  39. }