- yilianyunapi.IsStrToken

This commit is contained in:
gazebo
2019-07-11 11:03:52 +08:00
parent d7c2124068
commit 432816fae1
2 changed files with 10 additions and 7 deletions

View File

@@ -74,7 +74,7 @@ func (a *API) signParams(timestamp int64) string {
}
func (a *API) AccessAPI(apiName string, apiParams map[string]interface{}, token string) (retVal map[string]interface{}, err error) {
if len(token) < len("d65578a6fa414d738e0c44f85ac4b950") {
if !IsStrToken(token) {
token = ""
}
err = platformapi.AccessPlatformAPIWithRetry(a.client,
@@ -239,3 +239,7 @@ func (a *API) GetPrinterToken(machineCode, qrKey string) (tokenInfo *TokenInfo,
}
return tokenInfo, err
}
func IsStrToken(possibleToken string) bool {
return len(possibleToken) >= len("d65578a6fa414d738e0c44f85ac4b950")
}