dao.go 808 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package resource
  2. import (
  3. "context"
  4. "go-common/app/interface/main/app-intl/conf"
  5. "go-common/app/service/main/resource/model"
  6. rscrpc "go-common/app/service/main/resource/rpc/client"
  7. "go-common/library/ecode"
  8. )
  9. // Dao is archive dao.
  10. type Dao struct {
  11. // rpc
  12. rscRPC *rscrpc.Service
  13. }
  14. // New new a archive dao.
  15. func New(c *conf.Config) (d *Dao) {
  16. d = &Dao{
  17. // rpc
  18. rscRPC: rscrpc.New(c.ResourceRPC),
  19. }
  20. return
  21. }
  22. // PlayerIcon is.
  23. func (d *Dao) PlayerIcon(c context.Context) (res *model.PlayerIcon, err error) {
  24. if res, err = d.rscRPC.PlayerIcon(c); err != nil {
  25. if ecode.Cause(err) == ecode.NothingFound {
  26. res, err = nil, nil
  27. }
  28. }
  29. return
  30. }
  31. // PasterCID get all paster cid.
  32. func (d *Dao) PasterCID(c context.Context) (cids map[int64]int64, err error) {
  33. return d.rscRPC.PasterCID(c)
  34. }