client.go 516 B

123456789101112131415161718192021222324252627282930
  1. package rpc
  2. import (
  3. "context"
  4. "go-common/app/service/main/antispam/model"
  5. "go-common/library/net/rpc"
  6. )
  7. const (
  8. _appid = "antispam.service"
  9. )
  10. // Client .
  11. type Client struct {
  12. *rpc.Client2
  13. }
  14. // NewClient .
  15. func NewClient(c *rpc.ClientConfig) *Client {
  16. s := &Client{}
  17. s.Client2 = rpc.NewDiscoveryCli(_appid, c)
  18. return s
  19. }
  20. // Filter .
  21. func (cli *Client) Filter(ctx context.Context, arg *model.Suspicious) (res *model.SuspiciousResp, err error) {
  22. err = cli.Call(ctx, "Filter.Check", arg, &res)
  23. return
  24. }