From 0ab9960587ececb5d3e13e7fb062e2f67308f9e7 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 30 十一月 2021 13:33:03 +0800 Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。 --- HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 44 ++++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 838ba08..a4aeaed 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -37,7 +37,7 @@ /// <returns></returns> public static ResponsePackNew GetLogicIdList() { - var jObject = new JObject { { "homeId", LogicMethod.HomeId } }; + var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List); //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) @@ -114,6 +114,7 @@ { var outputTypeJOb = new JObject { }; outputTypeJOb.Add("sid", dictionary.sid); + outputTypeJOb.Add("delay", dictionary.delay); outputTypeJOb.Add("target_type", dictionary.target_type); var statusArray = new JArray { }; foreach (var dic in dictionary.status) @@ -127,6 +128,11 @@ outputArray.Add(outputTypeJOb); } + + var noticeConfigJObject = new JObject(); + noticeConfigJObject.Add("enable", logic.noticeConfig.enable); + noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent); + var pushConfigsArray = new JArray { }; if (logic.pushConfigs.Count > 0) { //聽鎺ㄩ�佹枃鏈� @@ -135,7 +141,6 @@ var pushConfigJob = new JObject { }; pushConfigJob.Add("pushMethod", pushConfig.pushMethod); - pushConfigJob.Add("pushContent", pushConfig.pushContent); var accountArray = new JArray { }; foreach (var account in pushConfig.pushTarget) { @@ -149,31 +154,29 @@ var logicjArray = new JArray { }; var logicIfon = new JObject { }; logicIfon.Add("sid", logic.sid); - logicIfon.Add("gatewayId", LogicMethod.GatewayId); + logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId); logicIfon.Add("name", logic.name); logicIfon.Add("relation", logic.relation); logicIfon.Add("enable", logic.enable); logicIfon.Add("cycle", cycleJObject); logicIfon.Add("input", inputArray); logicIfon.Add("output", outputArray); + logicIfon.Add("noticeConfig", noticeConfigJObject); logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); - var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } }; - responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add); + var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } }; + responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add,5); //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) { RefreshToken(); AddLogic(logic); } - } catch (Exception e) { var dd = e.Message; } - - return responsePackNew; } /// <summary> @@ -207,7 +210,10 @@ { var conditionJOb = new JObject { }; conditionJOb.Add("key", dic["key"]); - conditionJOb.Add("comparator", dic["comparator"]); + var c1 = ""; + dic.TryGetValue("comparator", out c1); + c1 = string.IsNullOrEmpty(c1) ? "" : c1; + conditionJOb.TryAdd("comparator", c1); conditionJOb.Add("data_type", dic["data_type"]); conditionJOb.Add("value", dic["value"]); conditionArray.Add(conditionJOb); @@ -221,6 +227,7 @@ { var outputTypeJOb = new JObject { }; outputTypeJOb.Add("sid", dictionary.sid); + outputTypeJOb.Add("delay", dictionary.delay); outputTypeJOb.Add("target_type", dictionary.target_type); var statusArray = new JArray { }; foreach (var dic in dictionary.status) @@ -234,15 +241,19 @@ outputArray.Add(outputTypeJOb); } + var noticeConfigJObject = new JObject(); + noticeConfigJObject.Add("enable", logic.noticeConfig.enable); + noticeConfigJObject.Add("noticeContent", logic.noticeConfig.noticeContent); + var pushConfigsArray = new JArray { }; if (logic.pushConfigs.Count > 0) - { //聽鎺ㄩ�佹枃鏈� + { + //聽鎺ㄩ�佹枃鏈� foreach (var pushConfig in logic.pushConfigs) { var pushConfigJob = new JObject { }; pushConfigJob.Add("pushMethod", pushConfig.pushMethod); - pushConfigJob.Add("pushContent", pushConfig.pushContent); var accountArray = new JArray { }; foreach (var account in pushConfig.pushTarget) { @@ -257,18 +268,21 @@ var logicIfon = new JObject { }; logicIfon.Add("userLogicId", logic.userLogicId); logicIfon.Add("sid", logic.sid); - logicIfon.Add("gatewayId", LogicMethod.GatewayId); + logicIfon.Add("gatewayId", LogicMethod.CurrLogicMethod.GatewayId); logicIfon.Add("name", logic.name); logicIfon.Add("relation", logic.relation); logicIfon.Add("enable", logic.enable); logicIfon.Add("cycle", cycleJObject); logicIfon.Add("input", inputArray); logicIfon.Add("output", outputArray); + logicIfon.Add("noticeConfig", noticeConfigJObject); logicIfon.Add("pushConfigs", pushConfigsArray); logicjArray.Add(logicIfon); - var jObject = new JObject { { "homeId", LogicMethod.HomeId }, { "logics", logicjArray } }; - responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update); + var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } }; + + string str = jObject.ToString(); + responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update,5); //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) { @@ -280,8 +294,6 @@ { var dd = e.Message; } - - return responsePackNew; } /// <summary> -- Gitblit v1.8.0