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

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