You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
473 B
22 lines
473 B
package tianyancha
|
|
|
|
import (
|
|
"encoding/json"
|
|
"gopkg.in/dtapps/go-library.v3/utils/gohttp"
|
|
"net/http"
|
|
)
|
|
|
|
type App struct{}
|
|
|
|
func (app *App) request(url string, params map[string]interface{}, method string) (resp []byte, err error) {
|
|
// 请求
|
|
if method == http.MethodGet {
|
|
get, err := gohttp.Get(url, params)
|
|
return get.Body, err
|
|
} else {
|
|
paramsStr, err := json.Marshal(params)
|
|
postJson, err := gohttp.PostJson(url, paramsStr)
|
|
return postJson.Body, err
|
|
}
|
|
}
|