|
- package pdd_union
-
- import (
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "github.com/syyongx/php2go"
- "sort"
- "strings"
- "time"
- )
-
- func Send(keyArr map[string]string, method string, param map[string]interface{}) (string, error) {
- param["client_id"] = keyArr["app_key"]
- param["type"] = method
- param["data_type"] = "JSON"
- param["timestamp"] = zhios_third_party_utils.Int64ToStr(time.Now().Unix())
- // 获取Key
- var keys []string
- for k := range param {
- keys = append(keys, k)
- }
- // 排序asc
- sort.Strings(keys)
- str := ""
- for _, v := range keys {
- if param[v] == "" {
- continue
- }
- str += v + zhios_third_party_utils.AnyToString(param[v])
- }
- param["sign"] = strings.ToUpper(php2go.Md5(keyArr["app_secret"] + str + keyArr["app_secret"]))
-
- url := "http://gw-api.pinduoduo.com/api/router"
- post, err := zhios_third_party_utils.CurlPost(url, param, nil)
- return string(post), err
- }
|