package qianzhu 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" "fmt" "github.com/tidwall/gjson" "strings" "time" ) var apiUrl = "https://live.qianzhu8.com/api/v2/platform/getToken" var url = "https://m.qianzhu8.com" func GetUrl(method, key, secret string, param map[string]string) string { str := "" param["timestamp"] = zhios_third_party_utils.Int64ToStr(time.Now().Unix()) param["platformId"] = key strMap := comm.KsortToStr(param) for _, v := range strMap { if str == "" { str += v + "=" + param[v] } else { str += "&" + v + "=" + param[v] } } str += secret param["sign"] = zhios_third_party_utils.Md5(str) for k, v := range param { if strings.Contains(apiUrl, "?") == false { apiUrl += "?" + k + "=" + v } else { apiUrl += "&" + k + "=" + v } } get, _ := zhios_third_party_utils.CurlGet(apiUrl, nil) token := gjson.Get(string(get), "data.accessToken").String() url += method + "?token=" + token + "&platformId=" + param["platformId"] + "&platformUniqueId=" + param["platformUniqueId"] + "&subPlatformId=" + param["subPlatformId"] fmt.Println(url) return url }