lss
2021-04-23 8ccc71771efec9434ad3b4a45c5f2ec11326d40f
HDL_ON/Common/ApiUtlis.cs
@@ -4,6 +4,8 @@
using HDL_ON.DAL;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.UI2.FuntionControlView.Video;
using Newtonsoft.Json;
using Shared;
namespace HDL_ON.Common
@@ -106,6 +108,26 @@
                }
                endTime = DateTime.Now.AddSeconds(5);
                MainPage.Log($"刷新个人信息成功");
                //int count = 0;
                //while (count < 10)
                //{
                //    if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                //    {
                //        System.Threading.Thread.Sleep(200);
                //    }
                //    else
                //    {
                //        break;
                //    }
                //    count++;
                //}
                //if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                //{
                //    return;
                //}
                try
                {
                    //===================房间=======================
@@ -255,15 +277,31 @@
                        MainPage.Log($"读取云端场景数据失败:Code:{pack.Code}; Msg:{pack.message}");
                    }
                    //===================读取安防列表==========================
                    GetSecurityList();
                    //===================读取逻辑列表==========================
                    UI.UI2.Intelligence.Automation.MainView.GetLogicList();
                    //===================读取可视对讲数据==========================
                    var flVideoInfo = HttpRequest.CheckFlVideo();
                    if(flVideoInfo.Code == StateCode.SUCCESS)
                    //判断是否有可视对讲数据,有则显示可视对讲icon
                    //var flVideoInfo = HttpRequest.CheckFlVideo();
                    //if(flVideoInfo.Code == StateCode.SUCCESS)
                    //{
                    //    FunctionList.List.videoIntercom1111 = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.Video.VideoClouds>(flVideoInfo.Data.ToString());
                    //}
                    //======================获取可视对讲设备列表====================
                    var videoInfo= VideoSend.GetVideoInfoList();
                    if (videoInfo.Code == StateCode.SUCCESS)
                    {
                        FunctionList.List.videoIntercom = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.Video.VideoClouds>(flVideoInfo.Data.ToString());
                        string videoList = videoInfo.Data.ToString();
                        FunctionList.List.videoIntercom = JsonConvert.DeserializeObject<List<UI.UI2.FuntionControlView.Video.Video>>(videoList);
                        foreach (var video in FunctionList.List.videoIntercom)
                        {
                            if (video.interphoneType == "IMOUVISIAL")
                            {
                                UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken;
                            }
                        }
                    }
                }
@@ -352,35 +390,6 @@
                    FunctionList.List.IniFunctionList(function.savePath,true);
                }
            }
        }
        /// <summary>
        /// 获取安防列表
        /// </summary>
        public void GetSecurityList()
        {
            var pack = Ins.HttpRequest.GetSecurityList();
            if (pack.Code == StateCode.SUCCESS)
            {
                var packList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Security>>(pack.Data.ToString());
                var sidList = new List<string>();
                foreach (var function in packList)
                {
                    sidList.Add(function.sid);
                }
                var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>());
                var infoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Security>>(infoListPack.Data.ToString());
                foreach (var function in infoList)
                {
                    function.SaveFile();
                    FunctionList.List.IniFunctionList(function.savePath, true);
                }
            }
            else
            {
                MainPage.Log($"读取安防列表失败:Code:{pack.Code}; Msg:{pack.message}");
            }
        }
    }
}