dao.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package bplus
  2. import (
  3. "go-common/app/interface/main/app-interface/conf"
  4. "go-common/library/cache/redis"
  5. httpx "go-common/library/net/http/blademaster"
  6. "go-common/library/queue/databus"
  7. )
  8. // Dao is favorite dao
  9. type Dao struct {
  10. client *httpx.Client
  11. favorPlus string
  12. clips string
  13. albums string
  14. allClip string
  15. allAlbum string
  16. clipDetail string
  17. albumDetail string
  18. groupsCount string
  19. dynamic string
  20. dynamicCount string
  21. dynamicDetail string
  22. // redis
  23. redis *redis.Pool
  24. // databus
  25. pub *databus.Databus
  26. }
  27. // New initial favorite dao
  28. func New(c *conf.Config) (d *Dao) {
  29. d = &Dao{
  30. client: httpx.NewClient(c.HTTPBPlus),
  31. favorPlus: c.Host.APILiveCo + _favorPlus,
  32. clips: c.Host.VC + _clips,
  33. albums: c.Host.VC + _allbums,
  34. allClip: c.Host.VC + _allClip,
  35. allAlbum: c.Host.VC + _allAlbum,
  36. clipDetail: c.Host.VC + _clipDetail,
  37. albumDetail: c.Host.VC + _albumDetail,
  38. groupsCount: c.Host.VC + _groupsCount,
  39. dynamic: c.Host.VC + _dynamic,
  40. dynamicCount: c.Host.VC + _dunamicCount,
  41. dynamicDetail: c.Host.VC + _dynamicDetail,
  42. redis: redis.NewPool(c.Redis.Contribute.Config),
  43. pub: databus.New(c.ContributePub),
  44. }
  45. return
  46. }