wxr
2024-09-23 579450c9b6e6706a74c7c8a2b64340a7c19722ad
刷新token失败,进入离线控制模式
1个文件已修改
42 ■■■■■ 已修改文件
HDL_ON/Common/ApiUtlis.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs
@@ -178,7 +178,48 @@
                MainPage.Log($"进入读取云端数据线程");
                //===================刷新Token=======================
                code = Ins.HttpRequest.RefreshToken();
                if (code != StateCode.SUCCESS)
                {
                    DownloadDataComplete = true;
                    hadInternet = false;
                    try
                    {
                        var spatialInfoDataBytes = FileUtlis.Files.ReadFile("SpatialInfoData");
                        if (spatialInfoDataBytes != null)
                        {
                            var spatialInfoDataString = System.Text.Encoding.UTF8.GetString(spatialInfoDataBytes);
                            if (spatialInfoDataString != null && !string.IsNullOrEmpty(spatialInfoDataString))
                            {
                                var spatialInfoDataList = JsonConvert.DeserializeObject<List<SpatialInfo>>(spatialInfoDataString);
                                SpatialInfo.CurrentSpatial.UpdateSpatialList(spatialInfoDataList);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MainPage.Log("Error", $"{this.GetType()}:加载缓存房间数据异常:{ex.StackTrace}");
                    }
                    try
                    {
                        var fileList = Common.FileUtlis.Files.ReadFiles();
                        foreach (var file in fileList)
                        {
                            FunctionList.List.IniFunctionList(file, true);
                        }
                        Room.CurrentSpatial.InitRoomListFunctions();
                    }
                    catch (Exception ex)
                    {
                        MainPage.Log("Error", $"{this.GetType()}:加载缓存设备数据异常:{ex.StackTrace}");
                    }
                    MainPage.Log($"刷新token失败");
                    return;
                }
                else
                {
                    hadInternet = true;
                }
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
@@ -194,7 +235,6 @@
                            catch { }
                        });
                    }
                    MainPage.Log($"刷新token失败");
                    return;
                }
                MainPage.Log($"刷新token成功");