jhHttpClient.go 797 B

123456789101112131415161718192021222324252627282930313233343536
  1. package thirdparty
  2. import (
  3. "gd_management/common.in/config"
  4. "gd_management/common.in/httpClient"
  5. "gd_management/common.in/utils"
  6. "go.uber.org/zap"
  7. )
  8. /*
  9. const (
  10. jhHost = "http://v.juhe.cn/"
  11. jhApiPrefix = "driverLicense/query.php"
  12. jhAppKey = "1ef0aa20c3d4cbe71f4a799122625bb9"
  13. )
  14. func jhFullUrl() string {
  15. return fmt.Sprintf("%s/%s", jhHost, jhApiPrefix)
  16. }
  17. */
  18. func JhHttpGet(api string, data map[string]string) (result []byte, err error) {
  19. defer func() {
  20. l.Info("thirdparty",
  21. zap.String("api", api),
  22. zap.String("request", utils.MarshalJsonString(data)),
  23. zap.String("response", string(result)))
  24. }()
  25. if data == nil {
  26. data = make(map[string]string)
  27. }
  28. data["key"] = config.Conf.ThirdPart.JhAppKey
  29. result, err = httpClient.HttpGet(api, data)
  30. return result, err
  31. }