block.go 748 B

123456789101112131415161718192021222324252627282930313233
  1. package gorpc
  2. import (
  3. "context"
  4. rpcmodel "go-common/app/service/main/member/model/block"
  5. "go-common/library/ecode"
  6. )
  7. const (
  8. _blockInfo = "RPC.BlockInfo"
  9. _blockBatchInfo = "RPC.BlockBatchInfo"
  10. )
  11. // BlockInfo is
  12. func (s *Service) BlockInfo(c context.Context, arg *rpcmodel.RPCArgInfo) (res *rpcmodel.RPCResInfo, err error) {
  13. res = new(rpcmodel.RPCResInfo)
  14. err = s.client.Call(c, _blockInfo, arg, res)
  15. return
  16. }
  17. // BlockBatchInfo len(mids) <= 50
  18. func (s *Service) BlockBatchInfo(c context.Context, arg *rpcmodel.RPCArgBatchInfo) (res []*rpcmodel.RPCResInfo, err error) {
  19. if len(arg.MIDs) == 0 {
  20. return
  21. }
  22. if len(arg.MIDs) > 50 {
  23. err = ecode.RequestErr
  24. return
  25. }
  26. err = s.client.Call(c, _blockBatchInfo, arg, &res)
  27. return
  28. }