怡亚通rpc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
536 B

2 years ago
2 years ago
2 years ago
  1. package yytrpc
  2. import (
  3. "git.tetele.net/yueheng/conf"
  4. )
  5. type Req struct {
  6. SiteId string
  7. Dbname string
  8. }
  9. type Res struct {
  10. Errcode int
  11. Errmsg string
  12. }
  13. func rpc_server_conn(url ...string) (*OrderServiceClient, error) {
  14. var rpc_url string
  15. if len(url) > 0 && url[0] != "" {
  16. rpc_url = url[0]
  17. } else if conf.YYT_RPC_URL != "" {
  18. rpc_url = conf.YYT_RPC_URL
  19. } else {
  20. rpc_url = "127.0.0.1:" + conf.YYT_RPC_PORT
  21. }
  22. conn, _, err := DialOrderService("tcp", rpc_url)
  23. if err != nil {
  24. return nil, err
  25. }
  26. return conn, nil
  27. }