This commit is contained in:
suyl
2021-05-25 14:46:45 +08:00
parent 7ea090ec1b
commit 3c3931e811
4 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package qywxapi
import "encoding/json"
func (a *API) GetProviderToken() (token string, err error) {
params := map[string]interface{}{
"corpid": a.appID,
"provider_secret": a.secret,
}
str, _ := json.Marshal(params)
result, err := a.AccessAPI(tokenURL, string(str), true)
if result["provider_access_token"] != "" {
return result["provider_access_token"].(string), err
}
return token, err
}