- dingding.GetJSAPITicket

This commit is contained in:
gazebo
2019-04-15 12:41:55 +08:00
parent 656db605de
commit 13c5f5378f
3 changed files with 22 additions and 1 deletions

View File

@@ -158,3 +158,16 @@ func (a *API) AccessAPI(action string, params map[string]interface{}, bodyMap ma
})
return retVal, err
}
func (a *API) GetJSAPITicket(getType string) (expiresIn int, ticket string, err error) {
if getType == "" {
getType = "jsapi"
}
result, err := a.AccessAPI("get_jsapi_ticket", map[string]interface{}{
"type": getType,
}, nil)
if err != nil {
return 0, "", err
}
return int(utils.MustInterface2Int64(result["expires_in"])), utils.Interface2String(result["ticket"]), nil
}