stat.go 646 B

12345678910111213141516171819202122232425262728
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/service/main/archive/api"
  5. "go-common/app/service/main/archive/model/archive"
  6. "go-common/library/log"
  7. "github.com/pkg/errors"
  8. )
  9. // Stat get a archive stat.
  10. func (d *Dao) Stat(c context.Context, aid int64) (st *api.Stat, err error) {
  11. if st, err = d.statCache(c, aid); err != nil {
  12. log.Error("%+v", err)
  13. } else if st != nil {
  14. return
  15. }
  16. arg := &archive.ArgAid2{Aid: aid}
  17. if st, err = d.arcRPC.Stat3(c, arg); err != nil {
  18. log.Error("d.arcRPC.Stat3(%v) error(%v)", arg, err)
  19. if st, err = d.arcRPC2.Stat3(c, arg); err != nil {
  20. err = errors.Wrapf(err, "%v", arg)
  21. }
  22. }
  23. return
  24. }