第三方api接口
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

43 行
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. 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. }