From 390261037c530be2a59e99a93ed44f6817d0d006 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 12 六月 2023 21:18:58 +0800 Subject: [PATCH] 2023年06月12日21:18:47 --- app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java index a3e2047..28b4233 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java @@ -17,12 +17,17 @@ import java.util.regex.Pattern; /** - * 鐧婚檰鐣岄潰鐨勯�昏緫 + * 鐧诲綍鐣岄潰鐨勯�昏緫 */ public class HdlAccountLogic { private static volatile HdlAccountLogic sHdlAccountLogic; + /** + * 鑾峰彇褰撳墠瀵硅薄 + * + * @return HdlAccountLogic + */ public static synchronized HdlAccountLogic getInstance() { if (sHdlAccountLogic == null) { synchronized (HdlAccountLogic.class) { @@ -48,14 +53,12 @@ HttpClient.getInstance().requestFullHttp(full, jsonObject.toString(), true, true, new BaseSuccessFailureCallBeak() { @Override public void onSuccess(HttpResponsePack httpResponsePack) { - if (httpResponsePack.getData() != null) { + if (httpResponsePack != null && httpResponsePack.getData() != null) { Gson gson = new Gson(); String json = gson.toJson(httpResponsePack.getData()); LoginUserRegionBean loginUserRegionBean = new Gson().fromJson(json, LoginUserRegionBean.class); if (cloudCallBeak != null) { cloudCallBeak.onSuccess(loginUserRegionBean); - } else { - cloudCallBeak.onFailure(new Exception()); } } } @@ -88,15 +91,13 @@ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), true, true, new BaseSuccessFailureCallBeak() { @Override public void onSuccess(HttpResponsePack httpResponsePack) { - if (httpResponsePack.getData() != null) { + if (httpResponsePack != null && httpResponsePack.getData() != null) { Gson gson = new Gson(); String json = gson.toJson(httpResponsePack.getData()); LoginBean loginBean = new Gson().fromJson(json, LoginBean.class); saveUserData(loginBean); if (cloudCallBeak != null) { cloudCallBeak.onSuccess(loginBean); - } else { - cloudCallBeak.onFailure(new Exception()); } } } -- Gitblit v1.8.0