service.go 763 B

123456789101112131415161718192021222324252627282930313233343536
  1. package pgc
  2. import (
  3. "context"
  4. "go-common/app/interface/main/tv/conf"
  5. appDao "go-common/app/interface/main/tv/dao/app"
  6. "go-common/app/interface/main/tv/dao/cms"
  7. "go-common/app/interface/main/tv/dao/pgc"
  8. "go-common/app/interface/main/tv/model"
  9. )
  10. var ctx = context.Background()
  11. // Service .
  12. type Service struct {
  13. appDao *appDao.Dao
  14. cmsDao *cms.Dao
  15. dao *pgc.Dao
  16. conf *conf.Config
  17. styleLabel map[int64][]*model.ParamStyle // style label
  18. }
  19. // New .
  20. func New(c *conf.Config) *Service {
  21. srv := &Service{
  22. conf: c,
  23. appDao: appDao.New(c),
  24. cmsDao: cms.New(c),
  25. dao: pgc.New(c),
  26. styleLabel: make(map[int64][]*model.ParamStyle),
  27. }
  28. srv.styleCache()
  29. go srv.upStyleCache() // style label cache
  30. return srv
  31. }