|
|
@@ -31,6 +31,11 @@ func GetGoodsDetail(id, secret string, param map[string]interface{}) *NovajoGood |
|
|
|
json.Unmarshal([]byte(data), &list) |
|
|
|
return &list |
|
|
|
} |
|
|
|
func GetOrder(id, secret string, param []int64) { |
|
|
|
send, _ := SendPost("/kol/claim", id, secret, param) |
|
|
|
fmt.Println(send) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//https://dyb.novajo.cn/open/kol-api |
|
|
|
func Send(method string, id, secret string, param map[string]interface{}) (string, error) { |
|
|
@@ -57,8 +62,41 @@ func Send(method string, id, secret string, param map[string]interface{}) (strin |
|
|
|
} |
|
|
|
} |
|
|
|
fmt.Println(url) |
|
|
|
json, err := zhios_third_party_utils.CurlGet(url, nil) |
|
|
|
fmt.Println(string(json)) |
|
|
|
json1, err := zhios_third_party_utils.CurlGet(url, nil) |
|
|
|
fmt.Println(string(json1)) |
|
|
|
fmt.Println(err) |
|
|
|
return string(json1), err |
|
|
|
} |
|
|
|
func SendPost(method string, id, secret string, param []int64) (string, error) { |
|
|
|
url := "https://api.novajo.cn/api" + method |
|
|
|
now := time.Now().Unix() * 1000 |
|
|
|
str := id |
|
|
|
str += "" |
|
|
|
for _, v := range param { |
|
|
|
if strings.Contains(str, "ids=") == false { |
|
|
|
str += "ids=" + zhios_third_party_utils.AnyToString(v) |
|
|
|
} else { |
|
|
|
str += "," + zhios_third_party_utils.AnyToString(v) |
|
|
|
} |
|
|
|
} |
|
|
|
str += zhios_third_party_utils.Int64ToStr(now) |
|
|
|
sign := php2go.Md5(secret + str + secret) |
|
|
|
fmt.Println(secret + str + secret) |
|
|
|
fmt.Println(sign) |
|
|
|
params := make(map[string]interface{}) |
|
|
|
params["id"] = id |
|
|
|
params["time"] = now |
|
|
|
params["sign"] = sign |
|
|
|
for k, v := range params { |
|
|
|
if strings.Contains(url, "?") == false { |
|
|
|
url += "?" + k + "=" + zhios_third_party_utils.AnyToString(v) |
|
|
|
} else { |
|
|
|
url += "&" + k + "=" + zhios_third_party_utils.AnyToString(v) |
|
|
|
} |
|
|
|
} |
|
|
|
fmt.Println(url) |
|
|
|
json1, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(param), nil) |
|
|
|
fmt.Println(string(json1)) |
|
|
|
fmt.Println(err) |
|
|
|
return string(json), err |
|
|
|
return string(json1), err |
|
|
|
} |