mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
HDL_ON/Common/ApiUtlis.cs
@@ -72,6 +72,8 @@
        /// 下载数据完成标记
        /// </summary>
        public bool DownloadDataComplete = false;
        public bool hadInternet = true;
        /// <summary>
        /// 下载数据
        /// </summary>
@@ -97,20 +99,19 @@
            string code = StateCode.SUCCESS;
            Inverter.Ins.H5Page = null;//重置光伏页面
            var downloadDataThread = new System.Threading.Thread(() =>
            {
                try
                {
                    //增加3秒云服务器连接检测,连不上服务器的时候不刷新数据
                    hadInternet = true;
                    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);
                    Console.WriteLine(DateTime.Now);
                    var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost, "", 3);
                    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();