service.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package reply
  2. import (
  3. "context"
  4. "go-common/app/interface/main/creative/conf"
  5. "go-common/app/interface/main/creative/dao/account"
  6. "go-common/app/interface/main/creative/dao/archive"
  7. "go-common/app/interface/main/creative/dao/article"
  8. "go-common/app/interface/main/creative/dao/elec"
  9. "go-common/app/interface/main/creative/dao/music"
  10. "go-common/app/interface/main/creative/dao/reply"
  11. "go-common/app/interface/main/creative/dao/search"
  12. "go-common/app/interface/main/creative/service"
  13. "go-common/library/log"
  14. )
  15. // Service reply.
  16. type Service struct {
  17. c *conf.Config
  18. sear *search.Dao
  19. acc *account.Dao
  20. elec *elec.Dao
  21. reply *reply.Dao
  22. arc *archive.Dao
  23. art *article.Dao
  24. mus *music.Dao
  25. }
  26. // New get reply service.
  27. func New(c *conf.Config, rpcdaos *service.RPCDaos) *Service {
  28. s := &Service{
  29. c: c,
  30. sear: search.New(c),
  31. acc: rpcdaos.Acc,
  32. elec: elec.New(c),
  33. reply: reply.New(c),
  34. arc: rpcdaos.Arc,
  35. art: article.New(c),
  36. mus: music.New(c),
  37. }
  38. return s
  39. }
  40. // Ping service.
  41. func (s *Service) Ping(c context.Context) (err error) {
  42. if err = s.sear.Ping(c); err != nil {
  43. log.Error("s.archive.Dao.PingDb err(%v)", err)
  44. }
  45. return
  46. }