第三方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 egoer
  2. import (
  3. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  4. "encoding/json"
  5. "fmt"
  6. "github.com/tidwall/gjson"
  7. "strings"
  8. )
  9. func GetGoods(key, secret, version string, param map[string]interface{}) []EgoerGoods {
  10. send, err := PostSend("/openapi/kwaimoney/product/queryProductList", key, secret, version, param)
  11. var data = make([]EgoerGoods, 0)
  12. if err != nil {
  13. return data
  14. }
  15. list := gjson.Get(send, "data.data").String()
  16. json.Unmarshal([]byte(list), &data)
  17. return data
  18. }
  19. //https://x.egoer.cn/userhome/wordPage 快手团长商品
  20. //a8a6bbf6afad4ffa885986c5a7a1d0a7
  21. //redu20242672GtFyuLYMwmUqX3
  22. func PostSend(method, key, secret, version string, param map[string]interface{}) (string, error) {
  23. urls := "https://open.redu.com/service" + method
  24. param["appkey"] = key
  25. param["version"] = version
  26. param["appSecret"] = secret
  27. for k, v := range param {
  28. if strings.Contains(urls, "?") == false {
  29. urls += "?" + k + "=" + zhios_third_party_utils.AnyToString(v)
  30. } else {
  31. urls += "&" + k + "=" + zhios_third_party_utils.AnyToString(v)
  32. }
  33. }
  34. fmt.Println(urls)
  35. fmt.Println(zhios_third_party_utils.SerializeStr(param))
  36. post, err := zhios_third_party_utils.CurlPost(urls, zhios_third_party_utils.SerializeStr(param), nil)
  37. fmt.Println(string(post))
  38. fmt.Println(err)
  39. return string(post), err
  40. }