From efcffde735fa65ae34bae0bcc86313b74ed0e36c Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 20 五月 2024 13:47:38 +0800
Subject: [PATCH] 优化离线数据

---
 HDL-ON_Android/Properties/AndroidManifest.xml   |    2 +-
 HDL-ON_iOS/Info.plist                           |    4 ++--
 HDL_ON/Common/ApiUtlis.cs                       |   23 +++++++++++++++++++++--
 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs |    9 ++++++++-
 HDL_ON/UI/MainPage.cs                           |    2 +-
 5 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index d6211f7..e38e966 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.4.4" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202404121">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.4.5" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202405201">
 	<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
 	<uses-permission android:name="android.permission.RECEIVE_SMS" />
 	<!--鍙嬬洘-->
diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist
index 1eb9e94..136f2cf 100644
--- a/HDL-ON_iOS/Info.plist
+++ b/HDL-ON_iOS/Info.plist
@@ -11,7 +11,7 @@
 	<key>CFBundleName</key>
 	<string>On Pro</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.4.4</string>
+	<string>2.4.5</string>
 	<key>CFBundleURLTypes</key>
 	<array>
 		<dict>
@@ -36,7 +36,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>2.4.4</string>
+	<string>2.4.5</string>
 	<key>LSApplicationQueriesSchemes</key>
 	<array>
 		<string>weixinULAPI</string>
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 09393f6..2094e6c 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -97,7 +97,7 @@
             string code = StateCode.SUCCESS;
 
             Inverter.Ins.H5Page = null;//閲嶇疆鍏変紡椤甸潰
-
+            bool hadInternet = true;
             var downloadDataThread = new System.Threading.Thread(() =>
             {
                 try
@@ -106,11 +106,12 @@
                     var dataList = new List<GlobalRegionListRes>();
                     var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark });
                     Console.WriteLine(DateTime.Now);
-                    var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost,"",3);
+                    var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost, "", 3);
                     Console.WriteLine(DateTime.Now);
                     if (revertObj == null || revertObj.Code != StateCode.SUCCESS)
                     {
                         DownloadDataComplete = true;
+                        hadInternet = false;
                         try
                         {
                             var spatialInfoDataBytes = FileUtlis.Files.ReadFile("SpatialInfoData");
@@ -146,6 +147,10 @@
 
                         return;
                     }
+                    else
+                    {
+                        hadInternet = true;
+                    }
                 }
                 catch (Exception ex)
                 {
@@ -153,6 +158,20 @@
                     DownloadDataComplete = true;
                     return;
                 }
+                finally
+                {
+                    if (!hadInternet)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            if (waitPage != null)
+                            {
+                                waitPage.Hide();
+                                waitPage.RemoveFromParent();
+                            }
+                        });
+                    }
+                }
                 MainPage.Log($"杩涘叆璇诲彇浜戠鏁版嵁绾跨▼");
                 //===================鍒锋柊Token=======================
                 code = Ins.HttpRequest.RefreshToken();
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 765f05c..89db532 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string VersionString = "2.4.4";
+        public static string VersionString = "2.4.5";
         ///// <summary>
         ///// 瀹㈡埛绔被鍨�
         ///// </summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
index a843941..c8c2e0e 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -61,7 +61,14 @@
             {
                 return null;
             }
-            var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicIdData>>(responsePackNew.Data.ToString());
+            List<LogicIdData> dateList = new List<LogicIdData>();
+            try
+            {
+                dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicIdData>>(responsePackNew.Data.ToString());
+            }catch (Exception ex)
+            {
+                MainPage.Log($"鑾峰彇閫昏緫ID鍒楄〃寮傚父锛歿ex.Message}");
+            }
             return dateList;
         }
         /// <summary>

--
Gitblit v1.8.0