diff --git a/platformapi/yilianyunapi/yilianyunapi.go b/platformapi/yilianyunapi/yilianyunapi.go
index 17236f09..31b6525c 100644
--- a/platformapi/yilianyunapi/yilianyunapi.go
+++ b/platformapi/yilianyunapi/yilianyunapi.go
@@ -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")
+}
diff --git a/platformapi/yilianyunapi/yilianyunapi_test.go b/platformapi/yilianyunapi/yilianyunapi_test.go
index b9dabfbb..38b739f6 100644
--- a/platformapi/yilianyunapi/yilianyunapi_test.go
+++ b/platformapi/yilianyunapi/yilianyunapi_test.go
@@ -20,12 +20,11 @@ func init() {
baseapi.Init(sugarLogger)
// 自有应用
- api = New("1039586024", "4885d07c2997b661102e4b6099c0bf3b")
- api.SetToken("968b52db8a0a40d184d67578aa4888f8")
+ // api = New("1039586024", "4885d07c2997b661102e4b6099c0bf3b")
+ // api.SetToken("968b52db8a0a40d184d67578aa4888f8")
// 开放应用
- // api = New("1098307169", "d5eedb40c99e6691b1ca2ba82a363d6a")
- // api.SetToken("d65578a6fa414d738e0c44f85ac4b950")
+ api = New("1098307169", "d5eedb40c99e6691b1ca2ba82a363d6a")
}
func handleError(t *testing.T, err error) {
@@ -59,7 +58,7 @@ func TestPrintMsg(t *testing.T) {
func TestPrintMsgWithToken(t *testing.T) {
// 4004606481
- err := api.PrintMsgWithToken("4004600675", utils.GetUUID(), "饿百取货码", "faketoken")
+ err := api.PrintMsgWithToken("4004600675", utils.GetUUID(), "饿百取货码", "b1a36aa8de5647d2b08af49db11a9c9d")
handleError(t, err)
}
@@ -70,7 +69,7 @@ func TestGetPrintStatus(t *testing.T) {
}
func TestGetPrintStatusWithToken(t *testing.T) {
- state, err := api.GetPrintStatusWithToken("4004600675", "faketoken")
+ state, err := api.GetPrintStatusWithToken("4004600675", "b1a36aa8de5647d2b08af49db11a9c9d")
handleError(t, err)
baseapi.SugarLogger.Debug(state)
}