From 9f9e16bc9b4caecf741339a0699d784558fbc738 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 21 十一月 2023 19:15:31 +0800
Subject: [PATCH] 2023年11月21日19:15:18

---
 app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 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 a835302..034fa23 100644
--- a/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
+++ b/app/src/main/java/com/hdl/photovoltaic/internet/HttpClient.java
@@ -69,7 +69,7 @@
      * @param callBack 鍥炶皟
      * @return -
      */
-    private Disposable request(String api, String body, CloudCallBeak<String> callBack) {
+    private Disposable requestPost(String api, String body, CloudCallBeak<String> callBack) {
 
 
         String requestUrl = HDLCloudUserApi.getRequestUrl(api);
@@ -111,7 +111,7 @@
      * @param callBack 鍥炶皟
      * @return -
      */
-    private Disposable requestFile(String api, File body, CloudCallBeak<String> callBack) {
+    private Disposable requestFilePost(String api, File body, CloudCallBeak<String> callBack) {
 
 
         String requestUrl = HDLCloudUserApi.getRequestUrl(api);
@@ -128,7 +128,7 @@
                         if (callBack != null) {
                             callBack.onSuccess(str);
 //                          System.out.println("http->鍥炲->" + requestUrl + "\r\n" + gson.fromJson(str, JsonObject.class).toString());
-                            System.out.println("http->鍥炲->" + requestUrl + "\r\n" + str);
+                            HdlLogLogic.print("http->鍥炲->" + requestUrl + "\r\n" + str, true);
                         }
                     }
 
@@ -137,7 +137,7 @@
                         HDLExceptionSubmitUtils.submit(requestUrl, body, e);
                         if (callBack != null) {
                             callBack.onFailure(e);
-                            System.out.println("http->鍥炲->" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}");
+                            HdlLogLogic.print("http->鍥炲->" + requestUrl + "\r\n" + "\"{code=\"" + e.getCode() + "," + "\"message=\"" + e.getMsg() + "}", true);
                         }
                     }
                 });
@@ -153,7 +153,7 @@
      * @param callBack 鍥炶皟
      */
     public Disposable requestHttp(String api, String body, CloudCallBeak<String> callBack) {
-        return request(api, body, callBack);
+        return requestPost(api, body, callBack);
     }
 
     /**
@@ -164,7 +164,7 @@
      * @param callBack 鍥炶皟
      */
     public Disposable requestHttpFile(String api, File body, CloudCallBeak<String> callBack) {
-        return requestFile(api, body, callBack);
+        return requestFilePost(api, body, callBack);
     }
 
 
@@ -209,7 +209,7 @@
             @Override
             public void run() {
                 try {
-                    HdlLogLogic.print("http->鍙戦��->", fullUrl + "\r\n" + json);
+                    HdlLogLogic.print("http->鍙戦��->" + fullUrl + "\r\n" + json, false);
                     OkHttpClient okHttpClient = new OkHttpClient();
                     RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8"), getJson(json));
                     final Request request = new Request.Builder()
@@ -222,7 +222,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);
+                            HdlLogLogic.print("http->鍥炲->" + response.request().url() + "\r\n" + s, false);
                             baseSuccessCallBeak.onSuccess(httpResponsePack);
 
                         } else {
@@ -235,7 +235,7 @@
                         call.enqueue(new Callback() {//寮傛
                             @Override
                             public void onFailure(@NonNull Call call, @NonNull IOException e) {
-                                HdlLogLogic.print("http->鍥炲->", "\r\n" + e.getMessage());
+                                HdlLogLogic.print("http->鍥炲->" + "\r\n" + e.getMessage(), false);
                             }
 
                             @Override
@@ -245,7 +245,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);
+                                    HdlLogLogic.print("http->鍥炲->" + "\r\n" + s, false);
                                 } else {
                                     baseSuccessCallBeak.onFailure(new HDLException(response.code(), response.message()));
                                 }
@@ -254,7 +254,7 @@
                     }
                 } catch (Exception e) {
                     baseSuccessCallBeak.onFailure(new HDLException(-100, e.getMessage()));
-                    HdlLogLogic.print("http->鍥炲->", "\r\n" + e.getMessage());
+                    HdlLogLogic.print("http->鍥炲->" + "\r\n" + e.getMessage(), false);
                 }
 
             }

--
Gitblit v1.8.0