From 334fa3f807b208335305889f0d5112fcd1f77bfb Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 24 三月 2021 16:19:00 +0800
Subject: [PATCH] 2021-3-24-2

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
index 2529c83..169cad3 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -150,7 +150,7 @@
         /// 绾㈠鐮佸涔�
         /// </summary>
         /// <returns></returns>
-        public static void CodeStudy(string deviceId, AttributesStatus buttonObj,Action<ResponsePackNew> action)
+        public static void CodeStudy(Control control, AttributesStatus buttonObj, Action<Cloud> action)
         {
             var job = new JObject { };
             job.Add("key", buttonObj.key);
@@ -160,22 +160,33 @@
             job.Add("value", valuejArray);
             var jArray = new JArray { };
             jArray.Add(job);
-            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } };
-            ResponsePackNew responsePackNew = null;
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } };
+            Cloud cloud = null;
             new System.Threading.Thread(() =>
             {
 
                 try
                 {
                     //鍙戦�佺孩澶栫爜瀛︿範鍛戒护
-                    responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy);
+                    var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy);
+                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                    {
+                        Method method = new Method();
+                        Method.buttondata = "";
+                        cloud = method.MqttDate("鎸夐敭", control.sid, 25);
+                    }
+                    else
+                    {
+                        Method method = new Method();
+                        method.ErrorShow(responsePackNew, "");
+                    }
                 }
                 catch { }
                 finally
                 {
                     Application.RunOnMainThread(() =>
                     {
-                        action(responsePackNew);
+                        action(cloud);
                     });
                 }
 
@@ -267,7 +278,6 @@
             { IsBackground = true }.Start();
 
         }
-
         /// <summary>
         ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 
         /// </summary>

--
Gitblit v1.8.0