wxr
2023-11-07 e06be53dff56744de8db2a2aec136d494cc187bf
Merge branch 'Dev-Branch' of http://59.41.255.150:6688/r/~wxr/OnPro into Dev-Branch
13个文件已修改
254 ■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/Resource.designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini
@@ -1231,6 +1231,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -2633,6 +2636,10 @@
7174=照明度高于
7175=照明度低于
7176=光照
7177=执行模式
7178=改变才执行
7179=收到就执行
@@ -4023,6 +4030,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -5406,6 +5416,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -6795,6 +6808,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -8120,6 +8136,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Відеозамок дверей
8502=Кількість електроенергії
HDL-ON_Android/Resources/Resource.designer.cs
@@ -15,7 +15,7 @@
{
    
    
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.1.111")]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.0.99")]
    public partial class Resource
    {
        
HDL-ON_iOS/Resources/Language.ini
@@ -1231,6 +1231,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -2633,6 +2636,9 @@
7174=照明度高于
7175=照明度低于
7176=光照
7177=执行模式
7178=改变才执行
7179=收到就执行
@@ -4023,6 +4029,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -5406,6 +5415,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -6795,6 +6807,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Video door lock
8502=Electric quantity
@@ -8120,6 +8135,9 @@
7174=Exceed
7175=Under
7176=HV
7177=Execution mode
7178=Change execution
7179=Execute on receipt
8501=Відеозамок дверей
8502=Кількість електроенергії
HDL_ON/Common/ApiUtlis.cs
@@ -535,11 +535,12 @@
                        //======================安防====================
                        GetSecurityList();
                    })
                    { IsBackground = true }.Start();
                    //===================读取逻辑列表==========================
                    Logic.LogicList.Clear();//主页下拉强制刷新自动化列表
                        MainView.GetLogicList();//读取自动化列表
                    })
                    { IsBackground = true }.Start();
                    //======================注册推送====================
                    httpRequest.RegisteredPush();
HDL_ON/Common/R.cs
@@ -3555,6 +3555,18 @@
        /// 光照
        /// </summary>
        public const int guangzhao = 7176;
        /// <summary>
        /// 执行模式
        /// </summary>
        public const int zhixingmoshi = 7177;
        /// <summary>
        /// 改变才执行
        /// </summary>
        public const int gaibiancaizhixing = 7178;
        /// <summary>
        /// 收到就执行
        /// </summary>
        public const int shoudaojiuzhixing = 7179;
  
HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </summary>
        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        const string APP_KEY = "HDL-HOME-APP-TEST";
        const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
using Newtonsoft.Json;
namespace HDL_ON.UI.UI2.Intelligence.Automation
@@ -42,6 +41,10 @@
        /// 人体传感器持续时间专用
        /// </summary>
        private string hold_time=string.Empty;
        /// <summary>
        /// 检测类型 配合condition_type=3时使用,没有该字段、该值或0: 状态检测(每次收到状态就成立),1:动作检测(需要切换状态才成立)
        /// </summary>
        private string detect_type = "0";
        
@@ -227,6 +230,31 @@
                        };
                        LogicView.FunTypeView view3 = new LogicView.FunTypeView();
                        view3.frameLayout.Y = view2.frameLayout.Bottom;
                        view3.btnText.TextID = StringId.zhixingmoshi;
                        view3.btnState.TextID = StringId.shoudaojiuzhixing;
                        fLayout.AddChidren(view3.FLayoutView());
                        view3.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence };
                            this.AddChidren(frame);
                            LogicView.SwitchView switchView = new LogicView.SwitchView();
                            switchView.FLayoutView(frame, StringId.gaibiancaizhixing, StringId.shoudaojiuzhixing, view3.btnState.Text, 2, (intValue) =>
                            {
                                if (StringId.gaibiancaizhixing == intValue)
                                {
                                    this.detect_type = "1";
                                }
                                else
                                {
                                    this.detect_type = "0";
                                }
                                view3.btnState.TextID = intValue;
                                selectedState = device.spk + "_" + this.detect_type;
                            });
                        };
                        if (edit)
                        {
@@ -242,6 +270,18 @@
                                    view2.btnState.Text = LogicMethod.Current.getTimeStr(inputs.hold_time); 
                                    view2.btnState.Name = h + ":" + m + ":" + s;
                                    this.hold_time = inputs.hold_time;
                                }
                                if (!string.IsNullOrEmpty(inputs.detect_type))
                                {
                                    this.detect_type = inputs.detect_type;
                                    if (inputs.detect_type == "1")
                                    {
                                        view3.btnState.TextID = StringId.gaibiancaizhixing;
                                    }
                                    else
                                    {
                                        view3.btnState.TextID = StringId.shoudaojiuzhixing;
                                    }
                                }
                            }
                            catch { }
@@ -843,6 +883,7 @@
                {
                    //人体存在传感器
                    inputDevice.hold_time = this.hold_time;
                    inputDevice.detect_type = this.detect_type;
                }
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -504,6 +504,17 @@
                                        {
                                            int time = int.Parse(inputCondition.hold_time);
                                            inputView.btnState.Text += "持续" + LogicMethod.Current.getTimeStr(inputCondition.hold_time).Replace("0s", "");
                                        }
                                        if (!string.IsNullOrEmpty(inputCondition.detect_type))
                                        {
                                            if (inputCondition.detect_type == "1")
                                            {
                                                inputView.btnState.Text += "," + Language.StringByID(StringId.gaibiancaizhixing);
                                            }
                                            else
                                            {
                                                inputView.btnState.Text += "," + Language.StringByID(StringId.shoudaojiuzhixing);
                                            }
                                        }
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -107,6 +107,10 @@
        /// </summary>
        public string identifier = "";
        /// <summary>
        /// 检测类型 配合condition_type=3时使用,没有该字段、该值或0: 状态检测(每次收到状态就成立),1:动作检测(需要切换状态才成立);
        /// </summary>
        public string detect_type = "0";
        /// <summary>
        /// 人体移动传感器(带持续时间)
        /// </summary>
        public string hold_time = "";
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -1080,18 +1080,17 @@
                //不是主账号直接返回
                return;
            }
            List<LogicData> logicDataList = new List<LogicData>();
            List<LogicIdData> logicDataList = new List<LogicIdData>();
            logicDataList.Clear();
            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    //获取逻辑ID列表,目前针对所有<备注:如果只针对当前手机的话,可以直接拿缓存数据自动化列表遍历>
                    var idStr = Send.Current.GetLogicIdList();
                    if (idStr != null)
                    var idStrList = Send.Current.GetLogicIdList();
                    if (idStrList != null)
                    {
                        var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                        logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
                        logicDataList.AddRange(idStrList);
                    }
                    ///有自动列表才处理
                    if (logicDataList.Count > 0)
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
@@ -197,7 +197,7 @@
            };
            ///显示之前状态
            if (stateVuale != "")
            if (!string.IsNullOrEmpty(stateVuale))
            {
                if (stateVuale == btnOn.Text)
                {
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -17,25 +17,54 @@
        /// </summary>
        public static void MainShow()
        {
            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    //获取自动化列表
                    GetLogicList();
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
            automationPage.RemoveAll();
            VerticalRefreshLayout vv = new VerticalRefreshLayout();
            vv.Height = Application.GetRealHeight(667 - 64 - 49);//模拟高度
            automationPage.AddChidren(vv);
            vv.BeginHeaderRefreshingAction += () =>
            {
                //清除之前自动化列表;
                            System.Threading.Tasks.Task.Run(() =>
                            {
                                try
                                {
                                    //强制更新自动化列表;
                Logic.LogicList.Clear();
                //获取自动列表
                                    //获取自动化列表
                GetLogicList();
                                }
                                catch { }
                                finally
                                {
                                    Application.RunOnMainThread(() =>
                                    {
                //刷新自动化界面
                MainShow();
                //关闭刷新View;
                vv.EndHeaderRefreshing();
                                    });
                                }
                            });
            };
            //获取自动化列表
            GetLogicList();
            for (int i = Logic.LogicList.Count - 1; i >= 0; i--)//降序排列
            //for (int i = 0; i < Logic.LogicList.Count; i++)
            {
                var currLogic = Logic.LogicList[i];
                ///上下间隔12像素
@@ -84,10 +113,9 @@
                GetSelectIcon(logicView.frameLayout, currLogic);
                if (i == 0)//降序排列
                //if (Logic.LogicList.Count - 1 == i)
                {
                    ///最后一个距离最底部12,界面显示效果作用;
                    vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
                                vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) });
                }
                if (currLogic.enable == "true")
                {
@@ -130,6 +158,11 @@
                };
                automationPage.AddChidren(btnTipNotText);
            }
                    });
                }
            });
        }
        /// <summary>
        ///  按+跳转到逻辑界面的方法
@@ -265,13 +298,11 @@
                //自动化列表为0才去获取自动化列表;
                return;
            }
            List<string> logicIdList = new List<string>();
            var logicIdList = new List<string>();
            //获取逻辑ID列表
            var idStr = Send.Current.GetLogicIdList();
            if (idStr != null)
            var dateList = Send.Current.GetLogicIdList();
            if (dateList != null)
            {
                var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
                for (int i = 0; i < dateList.Count; i++)
                {
                    //添加逻辑ID
@@ -279,16 +310,15 @@
                }
            }
            //获取自动化列表
            var logicListStr = Send.Current.GetLogic(logicIdList);
            if (logicListStr != null)
            var logicList = Send.Current.GetLogic(logicIdList);
            if (logicList != null)
            {
                var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(logicListStr.Data.ToString());
                for (int j = 0; j < logicList.Count; j++)
                {
                    var logic = logicList[j];
                    if (logic != null)
                    {
                        //查找是否已经存在该逻辑
                        //去重
                        var if_logic = Logic.LogicList.Find((c) => c.userLogicId == logic.userLogicId);
                        if (if_logic == null)
                        {
@@ -575,7 +605,7 @@
            }
        }
    }
    class LogicData
   public class LogicIdData
    {
        /// <summary>
        /// 云端唯一id
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -47,7 +47,7 @@
        /// 获取逻辑ID列表
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew GetLogicIdList(bool isTip = false)
        public List<LogicIdData> GetLogicIdList(bool isTip = false)
        {
            var jObject = new JObject { { "homeId", LogicMethod.Current.HomeId } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List, "获取逻辑ID列表");
@@ -61,14 +61,15 @@
            {
                return null;
            }
            return responsePackNew;
            var dateList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicIdData>>(responsePackNew.Data.ToString());
            return dateList;
        }
        /// <summary>
        /// 获取自动化详情
        /// </summary>
        /// <param name="listIdList">自动化ID列表</param>
        /// <returns></returns>
        public  ResponsePackNew GetLogic(List<string> listIdList, bool isTip = false)
        public  ResponsePackNew GetLogic1(List<string> listIdList, bool isTip = false)
        {
            var jArray = new JArray { };
            for (int i = 0; i < listIdList.Count; i++)
@@ -89,6 +90,35 @@
            }
            return responsePackNew;
        }
        /// <summary>
        /// 获取自动化详情
        /// </summary>
        /// <param name="listIdList">自动化ID列表</param>
        /// <returns></returns>
        public List<Logic> GetLogic(List<string> listIdList, bool isTip = false)
        {
            var jArray = new JArray { };
            for (int i = 0; i < listIdList.Count; i++)
            {
                jArray.Add(listIdList[i]);
            }
            var jObject = new JObject { { "userLogicIds", jArray } };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info, "获取自动化详情");
            //如果是token过期则刷新token
            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
            {
                RefreshToken();
                GetLogic(listIdList, isTip);
            }
            if (Check(responsePackNew, isTip) == false)
            {
                return null;
            }
            var logicList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(responsePackNew.Data.ToString());
            return logicList;
        }
        /// <summary>
        /// 添加自动化命令 
        /// </summary>
@@ -117,6 +147,10 @@
                    if (!string.IsNullOrEmpty(dictionary.hold_time))
                    {
                        inputTypeJOb.Add("hold_time", dictionary.hold_time);
                    }
                    if (!string.IsNullOrEmpty(dictionary.detect_type))
                    {
                        inputTypeJOb.Add("detect_type", dictionary.detect_type);
                    }
                    inputTypeJOb.Add("condition_type", dictionary.condition_type);
                    if (dictionary.condition_type=="9") {
@@ -248,6 +282,10 @@
                    if (!string.IsNullOrEmpty(dictionary.hold_time))
                    {
                        inputTypeJOb.Add("hold_time", dictionary.hold_time);
                    }
                    if (!string.IsNullOrEmpty(dictionary.detect_type))
                    {
                        inputTypeJOb.Add("detect_type", dictionary.detect_type);
                    }
                    inputTypeJOb.Add("condition_type", dictionary.condition_type);
                    if (dictionary.condition_type == "9")
@@ -573,21 +611,18 @@
        /// <returns></returns>
        public bool Check(ResponsePackNew r, bool isTip)
        {
            if (r.Code == "0" && r.Data != null && r.Data.ToString() != "")
            {
                return true;
            }
            if (r.Code != "0")
            {
                //失败时是否要提示
                if (isTip)
                {
                    if (r == null)
                    {
                        r = new ResponsePackNew { message = "没回复,请确认网络是否正常.", Code = "-1", };
                    }
                    new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})");
            if (r.Code == "0" && r.Data != null && r.Data.ToString() != "")
            {
                return true;
                }
            //失败时是否要提示
            if (isTip)
            {
                new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})");
            }
            return false;
        }