|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package egoer
-
- import (
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "encoding/json"
- "fmt"
- "github.com/syyongx/php2go"
- "github.com/tidwall/gjson"
- "strings"
- )
-
- func GetGoods(key, secret, version string, param map[string]interface{}) []EgoerGoods {
- send, err := PostSend("/openapi/kwaimoney/product/queryProductList", key, secret, version, param)
- var data = make([]EgoerGoods, 0)
- if err != nil {
- return data
- }
- list := gjson.Get(send, "data.data").String()
- json.Unmarshal([]byte(list), &data)
- return data
- }
-
- // https://x.egoer.cn/userhome/wordPage 快手团长商品
- // a8a6bbf6afad4ffa885986c5a7a1d0a7
- // redu20242672GtFyuLYMwmUqX3
- func PostSend(method, key, secret, version string, param map[string]interface{}) (string, error) {
- urls := "https://open.redu.com/service" + method
- param["appkey"] = key
- param["version"] = version
- param["appSecret"] = secret
-
- for k, v := range param {
- if k == "title" {
- v = php2go.URLEncode(zhios_third_party_utils.AnyToString(v))
- }
- if strings.Contains(urls, "?") == false {
- urls += "?" + k + "=" + zhios_third_party_utils.AnyToString(v)
- } else {
- urls += "&" + k + "=" + zhios_third_party_utils.AnyToString(v)
- }
- }
- fmt.Println(urls)
- fmt.Println(zhios_third_party_utils.SerializeStr(param))
- post, err := zhios_third_party_utils.CurlPost(urls, zhios_third_party_utils.SerializeStr(param), nil)
- fmt.Println(string(post))
- fmt.Println(err)
- return string(post), err
- }
|