|
@@ -391,9 +391,14 @@ public class CoreAuthServiceImpl implements CoreAuthService {
|
|
|
if (response.isSuccessful()) {
|
|
|
//获取用户信息
|
|
|
UserInfo userInfo = of(bodyStr);
|
|
|
+ if(userInfo == null){
|
|
|
+ log.warn("Login response is " + bodyStr);
|
|
|
+ return new Result<>().error("登录失败!");
|
|
|
+ }
|
|
|
+
|
|
|
return new Result().success(userInfo);
|
|
|
} else {
|
|
|
- log.warn("Http response is " + bodyStr);
|
|
|
+ log.warn("Login response is " + bodyStr);
|
|
|
ResBody body = new JsonMapper().parseJson(bodyStr, ResBody.class);
|
|
|
if (body != null && body.getCode() != null) {
|
|
|
return new Result().error(body.getDesc());
|
|
@@ -402,13 +407,17 @@ public class CoreAuthServiceImpl implements CoreAuthService {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
- return new Result().error("登录异常!");
|
|
|
+ return new Result().error("登录失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private UserInfo of(String bodyStr) {
|
|
|
JSONObject job=JSONObject.parseObject(bodyStr);
|
|
|
JSONObject content=job.getJSONObject("content");
|
|
|
+ if(content == null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
UserInfo userInfo = new UserInfo();
|
|
|
userInfo.setKey(content.getString("key"));
|
|
|
userInfo.setUserId(content.getLong("userId"));
|