package csjplatform import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/comm" zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" "crypto/md5" "fmt" "strings" "time" ) func Send(appkey, appSecret, method string, params map[string]interface{}) (string, error) { url := "https://ecom.pangolin-sdk-toutiao.com/" + method paramJson := comm.GetSortJson(params) paramJson = strings.ReplaceAll(paramJson, "\n", "") param := map[string]interface{}{ "app_id": appkey, "data": paramJson, "timestamp": time.Now().Unix(), "version": "1", "req_id": zhios_third_party_utils.UUIDString(), } sign := GetSign(appSecret, param) param["sign"] = sign param["sign_type"] = "MD5" data, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(param), nil) return string(data), err } func GetSign(secureKey string, m map[string]interface{}) string { var signStr = fmt.Sprintf("app_id=%v&data=%v&req_id=%v×tamp=%v%s", m["app_id"], m["data"], m["req_id"], m["timestamp"], secureKey) return fmt.Sprintf("%x", md5.Sum([]byte(signStr))) }