This commit is contained in:
苏尹岚
2021-02-18 14:05:16 +08:00
parent f258539de6
commit 5dd4dbbd1e
6 changed files with 144 additions and 4 deletions

View File

@@ -218,6 +218,8 @@ func (a *API) AccessAPI(cmd string, isGet bool, bizParams map[string]interface{}
return a.AccessAPI2(cmd, isGet, bizParams, resultKeyData, "")
}
//美团认证
//https://open-shangou.meituan.com/home/guide/38
func (a *API) GetOAuthCode(appPoiCode string) (retVal interface{}, err error) {
retVal, err = a.AccessAPI2("oauth/authorize", true, map[string]interface{}{
"app_poi_code": appPoiCode,
@@ -233,3 +235,19 @@ func (a *API) GetAccessToken(code string) (retVal interface{}, err error) {
}, "access_token", "")
return retVal, err
}
func (a *API) GetAccessToken2(appPoiCode string) (retVal interface{}, err error) {
retVal, err = a.AccessAPI2("oauth/authorize", true, map[string]interface{}{
"response_type": "token",
"app_poi_code": appPoiCode,
}, "access_token", "")
return retVal, err
}
func (a *API) RefreshAccessToken(token string) (retVal interface{}, err error) {
retVal, err = a.AccessAPI2("oauth/token", false, map[string]interface{}{
"grant_type": "refresh_token",
"refresh_token": token,
}, "access_token", "")
return retVal, err
}