From 7fdae87bc3de46b5b012f8987c6902cd8b054323 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 16 五月 2024 18:17:11 +0800
Subject: [PATCH] 2024年05月16日18:17:09

---
 app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java b/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
index d1ddd99..a74978c 100644
--- a/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
@@ -47,7 +47,7 @@
 
     private static volatile HttpClient sHttpClient;
 
-    private static final boolean isAddToMemory=false;
+    private static final boolean isAddToMemory = false;
 
     public static synchronized HttpClient getInstance() {
         if (sHttpClient == null) {
@@ -72,14 +72,15 @@
      */
     private Disposable requestPost(String api, String body, CloudCallBeak<String> callBack) {
         String requestUrl = HDLCloudUserApi.getRequestUrl(api);
-        HdlLogLogic.print("http->鍙戦��->" + requestUrl + "\r\n" + body, isAddToMemory);
+        HdlLogLogic.print("http---鍙戦��---" + requestUrl + "\r\n" + body, isAddToMemory);
+        //寮�鍙戠幆澧冮渶瑕佸姞(鐢ㄦ潵鍖哄垎onpro鍜屽厜浼廰pp浠g爜):HxHttp.builder().headers("x-lbs-version", "hdl-yt")
         return HxHttp.builder().url(requestUrl).raw(body).build().post().subscribeWith(new HDLResponse<String>() {
             @Override
             public void onResponse(String str) {
                 if (callBack != null) {
                     callBack.onSuccess(str);
-//                          System.out.println("http->鍥炲->" + requestUrl + "\r\n" + gson.fromJson(str, JsonObject.class).toString());
-                    HdlLogLogic.print("http->鍥炲->" + requestUrl + "\r\n" + str, isAddToMemory);
+//                          System.out.println("http---鍥炲---" + requestUrl + "\r\n" + gson.fromJson(str, JsonObject.class).toString());
+                    HdlLogLogic.print("http---鍥炲---" + requestUrl + "\r\n" + str, isAddToMemory);
                 }
             }
 
@@ -88,7 +89,7 @@
                 HDLExceptionSubmitUtils.submit(requestUrl, body, e);
                 if (callBack != null) {
                     callBack.onFailure(e);
-                    HdlLogLogic.print("http->鍥炲->" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}", isAddToMemory);
+                    HdlLogLogic.print("http---鍥炲---" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}", isAddToMemory);
                 }
             }
         });
@@ -108,14 +109,14 @@
 
 
         String requestUrl = HDLCloudUserApi.getRequestUrl(api);
-        HdlLogLogic.print("http->鍙戦��->" + requestUrl + "\r\n" + body, isAddToMemory);
+        HdlLogLogic.print("http---鍙戦��---" + requestUrl + "\r\n" + body, isAddToMemory);
         return HxHttp.builder().url(requestUrl).file(body).build().post().subscribeWith(new HDLResponse<String>() {
             @Override
             public void onResponse(String str) {
                 if (callBack != null) {
                     callBack.onSuccess(str);
-//                          System.out.println("http->鍥炲->" + requestUrl + "\r\n" + gson.fromJson(str, JsonObject.class).toString());
-                    HdlLogLogic.print("http->鍥炲->" + requestUrl + "\r\n" + str, isAddToMemory);
+//                          System.out.println("http---鍥炲---" + requestUrl + "\r\n" + gson.fromJson(str, JsonObject.class).toString());
+                    HdlLogLogic.print("http---鍥炲---" + requestUrl + "\r\n" + str, isAddToMemory);
                 }
             }
 
@@ -124,7 +125,7 @@
                 HDLExceptionSubmitUtils.submit(requestUrl, body, e);
                 if (callBack != null) {
                     callBack.onFailure(e);
-                    HdlLogLogic.print("http->鍥炲->" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}", isAddToMemory);
+                    HdlLogLogic.print("http---鍥炲---" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}", isAddToMemory);
                 }
             }
         });
@@ -241,7 +242,7 @@
             @Override
             public void run() {
                 try {
-                    HdlLogLogic.print("http->鍙戦��->" + fullUrl + "\r\n" + json, isAddToMemory);
+                    HdlLogLogic.print("http---鍙戦��---" + fullUrl + "\r\n" + json, isAddToMemory);
                     OkHttpClient okHttpClient = new OkHttpClient();
                     RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8"), getJson(json));
                     final Request request = new Request.Builder().url(fullUrl)//璇锋眰鐨剈rl
@@ -251,7 +252,7 @@
                         if (response.isSuccessful()) {
                             String s = Objects.requireNonNull(response.body()).string();
                             HttpResponsePack httpResponsePack = new Gson().fromJson(s, HttpResponsePack.class);
-                            HdlLogLogic.print("http->鍥炲->" + response.request().url() + "\r\n" + s, isAddToMemory);
+                            HdlLogLogic.print("http---鍥炲---" + response.request().url() + "\r\n" + s, isAddToMemory);
                             baseSuccessCallBeak.onSuccess(httpResponsePack);
 
                         } else {
@@ -264,7 +265,7 @@
                         call.enqueue(new Callback() {//寮傛
                             @Override
                             public void onFailure(@NonNull Call call, @NonNull IOException e) {
-                                HdlLogLogic.print("http->鍥炲->" + "\r\n" + e.getMessage(), isAddToMemory);
+                                HdlLogLogic.print("http---鍥炲---" + "\r\n" + e.getMessage(), isAddToMemory);
                             }
 
                             @Override
@@ -274,7 +275,7 @@
                                     String s = Objects.requireNonNull(response.body()).string();
                                     HttpResponsePack httpResponsePack = new Gson().fromJson(s, HttpResponsePack.class);
                                     baseSuccessCallBeak.onSuccess(httpResponsePack);
-                                    HdlLogLogic.print("http->鍥炲->" + "\r\n" + s, isAddToMemory);
+                                    HdlLogLogic.print("http---鍥炲---" + "\r\n" + s, isAddToMemory);
                                 } else {
                                     baseSuccessCallBeak.onFailure(new HDLException(response.code(), response.message()));
                                 }
@@ -283,7 +284,7 @@
                     }
                 } catch (Exception e) {
                     baseSuccessCallBeak.onFailure(new HDLException(-100, e.getMessage()));
-                    HdlLogLogic.print("http->鍥炲->" + "\r\n" + e.getMessage(), isAddToMemory);
+                    HdlLogLogic.print("http---鍥炲---" + "\r\n" + e.getMessage(), isAddToMemory);
                 }
 
             }
@@ -377,8 +378,6 @@
         final char[] strChar = valueStr.substring(0, 1).toCharArray();
         final char firstChar = strChar[0];
         //System.out.println("getJSONType firstChar = "+firstChar);
-        if (firstChar != '{' && firstChar != '[') return true;
-
-        return false;
+        return firstChar != '{' && firstChar != '[';
     }
 }

--
Gitblit v1.8.0