商品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.

23 lines
449 B

  1. package productrpc
  2. import (
  3. "git.tetele.net/tgo/conf"
  4. )
  5. func rpc_server_conn(url ...string) (*ProductServiceClient, error) {
  6. var rpc_url string
  7. if len(url) > 0 && url[0] != "" {
  8. rpc_url = url[0]
  9. } else if conf.PRODUCT_RPC_URL != "" {
  10. rpc_url = conf.PRODUCT_RPC_URL
  11. } else {
  12. rpc_url = "127.0.0.1:" + conf.PRODUCT_RPC_PORT
  13. }
  14. conn, _, err := DialProductService("tcp", rpc_url)
  15. if err != nil {
  16. return nil, err
  17. }
  18. return conn, nil
  19. }