From e74f8bfbe6c52f220deef5fc99a53c3a7872808d Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 11 四月 2023 17:08:34 +0800
Subject: [PATCH] Merge branch 'Dev-Wxr' into wjc

---
 HDL_ON/Common/ApiUtlis.cs |   75 +++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index da5ba70..9661856 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -349,12 +349,77 @@
                             complateDevice = true;
                             MainPage.Log($"============璁惧============瀹屾垚" + FunctionList.List.Functions.Count);
                         }
-                        //})
-                        //{ IsBackground = true }.Start();
 
-                        ////===================鍦烘櫙==========================
-                        //new System.Threading.Thread(() =>
-                        //{
+
+#if DEBUG
+                        DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl = true;
+#endif
+                        if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
+                        {
+                            var pack = Ins.HttpRequest.GetGroupControlList();
+                            if (pack != null)
+                            {
+                                if (pack.Code == StateCode.SUCCESS)
+                                {
+                                    try
+                                    {
+                                        var groupControlList = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
+                                        var readSidList = new List<string>();
+                                        foreach(var temp in groupControlList)
+                                        {
+                                            FunctionList.List.groupControls.Clear();
+                                            readSidList.Add(temp.userDeviceGroupControlId);
+                                            if (readSidList.Count >= 20)
+                                            {
+                                                var data = Ins.httpRequest.GetGroupControInfo(readSidList);
+                                                if(data != null)
+                                                {
+                                                    if(data.Code == StateCode.SUCCESS)
+                                                    {
+                                                        var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString());
+                                                        FunctionList.List.groupControls.AddRange(groupControlInfoList);
+                                                    }
+                                                    else
+                                                    {
+                                                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                                                    }
+                                                }
+                                                readSidList.Clear();
+                                            }
+                                        }
+                                        if (readSidList.Count > 0)
+                                        {
+                                            var data = Ins.httpRequest.GetGroupControInfo(readSidList);
+                                            if (data != null)
+                                            {
+                                                if (data.Code == StateCode.SUCCESS)
+                                                {
+                                                    var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString());
+                                                    FunctionList.List.groupControls.AddRange(groupControlInfoList);
+                                                }
+                                                else
+                                                {
+                                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                                                }
+                                            }
+                                            readSidList.Clear();
+                                        }
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        MainPage.Log($"璇诲彇缁勬帶鍒楄〃澶辫触:{ex.Message}");
+                                    }
+                                }
+                                else
+                                {
+                                    IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                                }
+                            }
+                        }
+
+
+                    //})
+                    //{ IsBackground = true }.Start();
 
                         try
                         {

--
Gitblit v1.8.0