client.go 642 B

1234567891011121314151617181920212223242526272829303132333435
  1. package client
  2. import (
  3. "context"
  4. "go-common/app/service/main/passport/model"
  5. "go-common/library/net/rpc"
  6. )
  7. const (
  8. _appid = "passport.service"
  9. )
  10. // Client2 struct
  11. type Client2 struct {
  12. client *rpc.Client2
  13. }
  14. // New Client2 init
  15. func New(c *rpc.ClientConfig) (s *Client2) {
  16. s = &Client2{}
  17. s.client = rpc.NewDiscoveryCli(_appid, c)
  18. return
  19. }
  20. const (
  21. _loginLogs = "RPC.LoginLogs"
  22. )
  23. // LoginLogs get the latest limit login logs.
  24. func (c2 *Client2) LoginLogs(c context.Context, arg *model.ArgLoginLogs) (res []*model.LoginLog, err error) {
  25. res = make([]*model.LoginLog, 0)
  26. err = c2.client.Call(c, _loginLogs, arg, &res)
  27. return
  28. }