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

api.go 1.3 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  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. func GetSign(appSecret string, param map[string]string) string {
  8. str := ""
  9. keys := comm.KsortToStr(param)
  10. for _, k := range keys {
  11. str += strings.ReplaceAll(param[k], "\\n", "")
  12. }
  13. return ""
  14. }
  15. func Send(method string, params map[string]interface{}, acctoken string) (string, error) {
  16. url := "http://jyb-admin-backend-test.aoyunltd.cn/api/v1" + method
  17. header := make(map[string]string, 0)
  18. if acctoken != "" {
  19. header["Authorization"] = "Bearer " + acctoken
  20. }
  21. data, err := zhios_third_party_utils.CurlPost(url, params, header)
  22. return string(data), err
  23. }
  24. func SendGet(method string, params map[string]interface{}, acctoken string) (string, error) {
  25. url := "http://jyb-admin-backend-test.aoyunltd.cn/api/v1" + method
  26. header := make(map[string]string, 0)
  27. if acctoken != "" {
  28. header["Authorization"] = "Bearer " + acctoken
  29. }
  30. for k, v := range params {
  31. if strings.Contains(url, "?") == false {
  32. url += "?" + k + "=" + zhios_third_party_utils.AnyToString(v)
  33. } else {
  34. url += "&" + k + "=" + zhios_third_party_utils.AnyToString(v)
  35. }
  36. }
  37. data, err := zhios_third_party_utils.CurlGet(url, header)
  38. return string(data), err
  39. }