1
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package kuaishou_mini
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -14,7 +14,7 @@ const (
|
||||
KuaiShouBashUrl = "https://open.kuaishou.com" // 域名
|
||||
|
||||
// 获取授权信息
|
||||
KuaiShouAuthLogin = "oauth2/mp/code2session" // 授权登录
|
||||
KuaiShouAuthLogin = KuaiShouBashUrl + "/oauth2/mp/code2session" // 授权登录
|
||||
)
|
||||
|
||||
type API struct {
|
||||
@@ -51,14 +51,11 @@ func New(appSecret, appId string, config ...*platformapi.APIConfig) *API {
|
||||
|
||||
// AccessAPI2 发送请求
|
||||
func (a *API) AccessAPI2(url string, params map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||
data, err := json.Marshal(params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||
func() *http.Request {
|
||||
request, _ := http.NewRequest(http.MethodPost, url, strings.NewReader(string(data)))
|
||||
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
request, _ := http.NewRequest(http.MethodPost, url, strings.NewReader(utils.Map2URLValues(params).Encode()))
|
||||
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
return request
|
||||
},
|
||||
a.config,
|
||||
|
||||
Reference in New Issue
Block a user