第三方api接口
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.

45 lines
1.3 KiB

  1. package macao_logistics
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/comm"
  4. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  5. "strings"
  6. )
  7. var Url = "https://jyb-admin-backend.aoyunltd.com/api/v1"
  8. func GetSign(appSecret string, param map[string]string) string {
  9. str := ""
  10. keys := comm.KsortToStr(param)
  11. for _, k := range keys {
  12. str += strings.ReplaceAll(param[k], "\\n", "")
  13. }
  14. return ""
  15. }
  16. func Send(method string, params map[string]interface{}, acctoken string) (string, error) {
  17. url := Url + method
  18. header := make(map[string]string, 0)
  19. if acctoken != "" {
  20. header["Authorization"] = "Bearer " + acctoken
  21. }
  22. data, err := zhios_third_party_utils.CurlPost(url, params, header)
  23. return string(data), err
  24. }
  25. func SendGet(method string, params map[string]interface{}, acctoken string) (string, error) {
  26. url := Url + method
  27. header := make(map[string]string, 0)
  28. if acctoken != "" {
  29. header["Authorization"] = "Bearer " + acctoken
  30. }
  31. for k, v := range params {
  32. if strings.Contains(url, "?") == false {
  33. url += "?" + k + "=" + zhios_third_party_utils.AnyToString(v)
  34. } else {
  35. url += "&" + k + "=" + zhios_third_party_utils.AnyToString(v)
  36. }
  37. }
  38. data, err := zhios_third_party_utils.CurlGet(url, header)
  39. return string(data), err
  40. }