dao.go 763 B

123456789101112131415161718192021222324252627282930313233
  1. package relation
  2. import (
  3. "context"
  4. "go-common/app/admin/main/credit/conf"
  5. relationmdl "go-common/app/service/main/relation/model"
  6. relationrpc "go-common/app/service/main/relation/rpc/client"
  7. "go-common/library/log"
  8. )
  9. // Dao is account dao.
  10. type Dao struct {
  11. // rpc
  12. relationRPC *relationrpc.Service
  13. }
  14. // New is initial for account .
  15. func New(c *conf.Config) (d *Dao) {
  16. d = &Dao{
  17. relationRPC: relationrpc.New(c.RPCClient.Relation),
  18. }
  19. return
  20. }
  21. // RPCStats rpc info get by muti mid .
  22. func (d *Dao) RPCStats(c context.Context, mids []int64) (res map[int64]*relationmdl.Stat, err error) {
  23. arg := &relationmdl.ArgMids{Mids: mids}
  24. if res, err = d.relationRPC.Stats(c, arg); err != nil {
  25. log.Error("d.relationRPC.Stats error(%v)", err)
  26. }
  27. return
  28. }