站点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.

48 lines
698 B

  1. package siterpc
  2. import (
  3. "errors"
  4. )
  5. /**
  6. * 获取code_bank一条可用记录
  7. * 2021/09/09
  8. * linsen
  9. */
  10. func GetOneCode(site_id, dbname string, url ...string) (string, error) {
  11. if dbname == "" {
  12. return "", errors.New("参数错误")
  13. }
  14. conn, err := rpc_server_conn(url...)
  15. if err != nil {
  16. return "", err
  17. }
  18. defer conn.Close()
  19. arg := SiteConfigItemReqArg{site_id, dbname, ""}
  20. req, err := SetReqData(arg)
  21. if err != nil {
  22. return "", err
  23. }
  24. res := &Response{}
  25. err = conn.GetOneCode(req, res)
  26. if err != nil {
  27. return "", err
  28. }
  29. res_data_de, err := GetResData(res)
  30. if err != nil {
  31. return "", err
  32. }
  33. if res_data_de == "" {
  34. return "", nil
  35. }
  36. return res_data_de, nil
  37. }