From 8042c8e7e73c06e005d3e9f94e0f8eb9548fcaa4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=88=98=E6=B4=AA=E9=9D=92?= Date: Sat, 12 Oct 2019 09:54:04 +0800 Subject: [PATCH] =?utf8?q?fix:=20=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E?= =?utf8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../agent/poa/service/AuthzService.java | 18 +++++++++++------- .../gateway/agent/poa/service/UserService.java | 14 +++++++++----- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/AuthzService.java b/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/AuthzService.java index 1d040b6..5ee463b 100644 --- a/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/AuthzService.java +++ b/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/AuthzService.java @@ -26,13 +26,17 @@ public class AuthzService { return null; } - JSONObject data = jsonObject.getJSONObject("data"); - - JSONArray roleArray = data.getJSONArray("roles"); - - List roles = roleArray.toJavaList(Role.class); - log.debug("{}", roles); + if (jsonObject.getIntValue("code") == 0) { + JSONObject data = jsonObject.getJSONObject("data"); + + JSONArray roleArray = data.getJSONArray("roles"); + + List roles = roleArray.toJavaList(Role.class); + log.debug("roles: [{}]", roles); + + return roles; + } - return roles; + return null; } } diff --git a/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/UserService.java b/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/UserService.java index 777c596..75182da 100644 --- a/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/UserService.java +++ b/gateway/src/main/java/com/supwisdom/institute/backend/gateway/agent/poa/service/UserService.java @@ -23,12 +23,16 @@ public class UserService { return null; } - JSONObject data = jsonObject.getJSONObject("data"); - - UserInfoModel userInfoModel = data.toJavaObject(UserInfoModel.class); - log.debug("userInfoModel: [{}]", userInfoModel); + if (jsonObject.getIntValue("code") == 0) { + JSONObject data = jsonObject.getJSONObject("data"); + + UserInfoModel userInfoModel = data.toJavaObject(UserInfoModel.class); + log.debug("userInfoModel: [{}]", userInfoModel); + + return userInfoModel; + } - return userInfoModel; + return null; } } -- 2.17.1