|
@ -119,3 +119,29 @@ func HttpBuildQuery(data map[string]string) string { |
|
|
|
|
|
|
|
|
return strings.Trim(query, "&") |
|
|
return strings.Trim(query, "&") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 对map进行拼接 |
|
|
|
|
|
* @param data map[string]string |
|
|
|
|
|
* @2021/10/14 |
|
|
|
|
|
* @wyy |
|
|
|
|
|
*/ |
|
|
|
|
|
func HttpBuildStringQuery(data map[string]string) string { |
|
|
|
|
|
|
|
|
|
|
|
keySlice := []string{} |
|
|
|
|
|
|
|
|
|
|
|
for k, _ := range data { |
|
|
|
|
|
keySlice = append(keySlice, k) |
|
|
|
|
|
} |
|
|
|
|
|
// sort.Strings(keySlice) //排序字符串
|
|
|
|
|
|
|
|
|
|
|
|
var query string |
|
|
|
|
|
|
|
|
|
|
|
for _, value := range keySlice { |
|
|
|
|
|
if value != "" && data[value] != "" { |
|
|
|
|
|
query += StringJoin(value, "=", data[value], "&") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return strings.Trim(query, "&") |
|
|
|
|
|
} |