From 6ecf843637329ab5637e431c418bb1362caf4076 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 27 Mar 2024 09:51:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=A3=E8=A2=8B=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kdq/api.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/kdq/api.go b/kdq/api.go index ec9bbf2..f2a6a0e 100644 --- a/kdq/api.go +++ b/kdq/api.go @@ -2,6 +2,7 @@ package kdq import ( zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" + "fmt" "github.com/syyongx/php2go" "io/ioutil" "log" @@ -14,19 +15,12 @@ import ( func KdqSend(appkey, appSecret, method string, params map[string]string) (string, error) { url := "https://open.xr876.cn/" + method now := time.Now().Unix() - param := map[string]string{ - "dev_username": appkey, - "timestamp": zhios_third_party_utils.Int64ToStr(now), - } - if params["phone"] != "" { - param["phone"] = params["phone"] - } - if params["userid"] != "" { - param["userid"] = params["userid"] - } + params["dev_username"] = appkey + params["timestamp"] = zhios_third_party_utils.Int64ToStr(now) sign := php2go.Md5(appkey + appSecret + zhios_third_party_utils.Int64ToStr(now)) - param["sign"] = sign - data, err := Post(url, param) + params["sign"] = sign + data, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(params), nil) + fmt.Println(string(data)) return string(data), err } func Post(urls string, param map[string]string) ([]byte, error) { @@ -44,5 +38,6 @@ func Post(urls string, param map[string]string) ([]byte, error) { } defer resp.Body.Close() res, err := ioutil.ReadAll(resp.Body) + fmt.Println(string(res)) return res, err }