up.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package client
  2. import (
  3. "context"
  4. "go-common/app/service/main/up/model"
  5. "go-common/library/net/rpc"
  6. )
  7. const (
  8. _Special = "RPC.Special"
  9. _Info = "RPC.Info"
  10. _UpStatBase = "RPC.UpStatBase"
  11. _SetUpSwitch = "RPC.SetUpSwitch"
  12. _UpSwitch = "RPC.UpSwitch"
  13. )
  14. const (
  15. _appid = "archive.service.up"
  16. )
  17. var (
  18. // _noRes = &struct{}{}
  19. )
  20. // Service rpc client
  21. type Service struct {
  22. client *rpc.Client2
  23. }
  24. // RPC rpc
  25. type RPC interface {
  26. // DEPRECATED: Please use gRPC service of func UpGroupMids instead, but must get datas in many times by one time of max 1000.
  27. Special(c context.Context, arg *model.ArgSpecial) (res []*model.UpSpecial, err error)
  28. // DEPRECATED: Please use gRPC service of func UpAttr instead.
  29. Info(c context.Context, arg *model.ArgInfo) (res *model.UpInfo, err error)
  30. }
  31. // New create
  32. func New(c *rpc.ClientConfig) (s *Service) {
  33. s = &Service{}
  34. s.client = rpc.NewDiscoveryCli(_appid, c)
  35. return
  36. }
  37. // Special special
  38. // DEPRECATED: Please use gRPC service of func UpGroupMids instead, but must get datas in many times by one time of max 1000.
  39. func (s *Service) Special(c context.Context, arg *model.ArgSpecial) (res []*model.UpSpecial, err error) {
  40. err = s.client.Call(c, _Special, arg, &res)
  41. return
  42. }
  43. // Info info
  44. // DEPRECATED: Please use gRPC service of func UpAttr instead.
  45. func (s *Service) Info(c context.Context, arg *model.ArgInfo) (res *model.UpInfo, err error) {
  46. err = s.client.Call(c, _Info, arg, &res)
  47. return
  48. }
  49. // UpStatBase base statis
  50. // DEPRECATED: Please use gRPC service func UpBaseStats instead.
  51. func (s *Service) UpStatBase(c context.Context, arg *model.ArgMidWithDate) (res *model.UpBaseStat, err error) {
  52. err = s.client.Call(c, _UpStatBase, arg, &res)
  53. return
  54. }
  55. // SetUpSwitch set up switch
  56. // DEPRECATED: Please use gRPC service func SetUpSwitch instead.
  57. func (s *Service) SetUpSwitch(c context.Context, arg *model.ArgUpSwitch) (res *model.PBSetUpSwitchRes, err error) {
  58. err = s.client.Call(c, _SetUpSwitch, arg, &res)
  59. return
  60. }
  61. // UpSwitch get up switch
  62. // DEPRECATED: Please use gRPC service func UpSwitch instead.
  63. func (s *Service) UpSwitch(c context.Context, arg *model.ArgUpSwitch) (res *model.PBUpSwitch, err error) {
  64. err = s.client.Call(c, _UpSwitch, arg, &res)
  65. return
  66. }