1
This commit is contained in:
@@ -3,14 +3,14 @@ package utils
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -200,6 +200,27 @@ func GenerateGetURL(baseURL, apiStr string, params map[string]interface{}) strin
|
||||
return baseURL + queryString
|
||||
}
|
||||
|
||||
func GenerateGetURL2(baseURL, apiStr string, params map[string]interface{}) string {
|
||||
queryString := ""
|
||||
bizContent := map[string]interface{}{"biz_content": params["biz_content"]}
|
||||
|
||||
paramsString := ""
|
||||
for k, v := range params {
|
||||
if k == "biz_content" {
|
||||
continue
|
||||
}
|
||||
paramsString += "&" + fmt.Sprintf("%s=%v", k, v)
|
||||
}
|
||||
|
||||
if params != nil {
|
||||
queryString = "?" + Map2URLValues(bizContent).Encode() + paramsString
|
||||
}
|
||||
if apiStr != "" {
|
||||
return baseURL + "/" + apiStr + queryString
|
||||
}
|
||||
return baseURL + queryString
|
||||
}
|
||||
|
||||
func BuildRequest(method, url, body, contentType string) (request *http.Request) {
|
||||
request, _ = http.NewRequest(method, url, strings.NewReader(body))
|
||||
if contentType == "" {
|
||||
|
||||
Reference in New Issue
Block a user