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.
29 lines
571 B
29 lines
571 B
package meituan
|
|
|
|
import (
|
|
"encoding/json"
|
|
"gopkg.in/dtapps/go-library.v2/utils/gohttp"
|
|
"net/http"
|
|
)
|
|
|
|
// App 美团联盟
|
|
type App struct {
|
|
Secret string // 秘钥
|
|
AppKey string // 渠道标记
|
|
}
|
|
|
|
func (app *App) request(url string, params map[string]interface{}, method string) (resp []byte, err error) {
|
|
|
|
// GET方式
|
|
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
|
|
}
|
|
|
|
}
|