From 22494af577e21a930abef309f2f60c03c9615bd1 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 07 七月 2023 18:16:55 +0800
Subject: [PATCH] 2023年07月07日18:16:52
---
app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java | 89 ++++++++++++++++++++++++++++----------------
1 files changed, 56 insertions(+), 33 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 27d9bfd..fae5e98 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlAccountLogic.java
@@ -3,6 +3,13 @@
import com.google.gson.Gson;
import com.google.gson.JsonObject;
+import com.hdl.linkpm.sdk.core.exception.HDLException;
+import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
+import com.hdl.linkpm.sdk.user.bean.HDLLoginBean;
+import com.hdl.linkpm.sdk.user.bean.HDLUserRegionBean;
+import com.hdl.linkpm.sdk.user.callback.ILoginCallBack;
+import com.hdl.linkpm.sdk.user.callback.IRegionByAccountCallBack;
+import com.hdl.linkpm.sdk.user.controller.HDLPMUserController;
import com.hdl.photovoltaic.ui.bean.LoginUserBean;
import com.hdl.photovoltaic.ui.bean.LoginUserRegionBean;
import com.hdl.photovoltaic.bean.HttpResponsePack;
@@ -46,27 +53,19 @@
*
* @param i_account 璐﹀彿
*/
- public void regionByAccount(String i_account, CloudCallBeak<LoginUserRegionBean> cloudCallBeak) {
- JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("account", i_account);
- String full = AppConfigManage.getAPPRegionUrl() + HttpApi.POST_RegionByUserAccount;
- HttpClient.getInstance().requestFullHttp(full, jsonObject.toString(), true, true, new BaseSuccessFailureCallBeak() {
+ public void regionByAccount(String i_account, CloudCallBeak<HDLUserRegionBean> cloudCallBeak) {
+ HDLPMUserController.getInstance().regionByAccount(i_account, new IRegionByAccountCallBack() {
@Override
- public void onSuccess(HttpResponsePack httpResponsePack) {
- 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);
- }
+ public void onSuccess(HDLUserRegionBean regionBean) {
+ if (cloudCallBeak != null) {
+ cloudCallBeak.onSuccess(regionBean);
}
}
@Override
- public void onFailure(Exception exception) {
+ public void onFailure(HDLException error) {
if (cloudCallBeak != null) {
- cloudCallBeak.onFailure(exception);
+ cloudCallBeak.onFailure(error);
}
}
});
@@ -76,39 +75,54 @@
* 鐧诲綍(B绔处鍙�)
* 閫氳繃璐﹀彿鍜屽瘑鐮�
*
- * @param account 鎵嬫満鎴栬�呴偖绠�
- * @param loginPwd 瀵嗙爜
- * @param cloudCallBeak -
+ * @param account 鎵嬫満鎴栬�呴偖绠�
+ * @param loginPwd 瀵嗙爜
+ * @param callBack -
*/
- public void loginByPassword(String account, String loginPwd, CloudCallBeak<LoginUserBean> cloudCallBeak) {
+ public void loginByPassword(String account, String loginPwd, ILoginCallBack callBack) {
String requestUrl = HttpApi.POST_Login;
JsonObject json = new JsonObject();
json.addProperty("account", account);
json.addProperty("loginPwd", loginPwd);
// json.addProperty("platform", "APP");
json.addProperty("grantType", "password");
-
- HttpClient.getInstance().requestHttp(requestUrl, json.toString(), true, true, new BaseSuccessFailureCallBeak() {
+ HDLPMUserController.getInstance().loginByPassword(account, loginPwd, new ILoginCallBack() {
@Override
- public void onSuccess(HttpResponsePack httpResponsePack) {
- if (httpResponsePack != null && httpResponsePack.getData() != null) {
- Gson gson = new Gson();
- String json = gson.toJson(httpResponsePack.getData());
- LoginUserBean loginUserBean = new Gson().fromJson(json, LoginUserBean.class);
- saveUserData(loginUserBean);
- if (cloudCallBeak != null) {
- cloudCallBeak.onSuccess(loginUserBean);
- }
+ public void onSuccess(HDLLoginBean loginBean) {
+
+ if (callBack != null) {
+ callBack.onSuccess(loginBean);
}
}
@Override
- public void onFailure(Exception exception) {
- if (cloudCallBeak != null) {
- cloudCallBeak.onFailure(exception);
+ public void onFailure(HDLException error) {
+ if (callBack != null) {
+ callBack.onFailure(error);
}
}
});
+// HttpClient.getInstance().requestHttp(requestUrl, json.toString(), true, true, new BaseSuccessFailureCallBeak() {
+// @Override
+// public void onSuccess(HttpResponsePack httpResponsePack) {
+// if (httpResponsePack != null && httpResponsePack.getData() != null) {
+// Gson gson = new Gson();
+// String json = gson.toJson(httpResponsePack.getData());
+// LoginUserBean loginUserBean = new Gson().fromJson(json, LoginUserBean.class);
+// saveUserData(loginUserBean);
+// if (cloudCallBeak != null) {
+// cloudCallBeak.onSuccess(loginUserBean);
+// }
+// }
+// }
+//
+// @Override
+// public void onFailure(Exception exception) {
+// if (cloudCallBeak != null) {
+// cloudCallBeak.onFailure(exception);
+// }
+// }
+// });
}
/**
@@ -122,6 +136,7 @@
String requestUrl = HttpApi.POST_Login;
JsonObject json = new JsonObject();
json.addProperty("grantType", "refresh_token");
+// json.addProperty("refreshToken", UserConfigManage.getInstance().getRefreshToken());
HttpClient.getInstance().requestHttp(requestUrl, json.toString(), true, true, new BaseSuccessFailureCallBeak() {
@Override
@@ -147,6 +162,14 @@
}
+ /**
+ * 閫�鍑虹櫥褰曟椂璋冪敤锛屾竻闄ゆ帹閫佹暟鎹�
+ */
+ public void SignOutClearData() {
+ String requestUrl = HttpApi.POST_GET_IMAGE_LOGOUT;
+ //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
+ }
+
public boolean isPhone(String phone) {
Pattern p = Pattern.compile("^((13[0-9])|(14[0|5|6|7|9])|(15[0-3])|(15[5-9])|(16[6|7])|(17[2|3|5|6|7|8])|(18[0-9])|(19[1|8|9]))\\d{8}$");
Matcher m = p.matcher(phone);
--
Gitblit v1.8.0