From 48c5a2c66c549d26fecadc6d2dad1924fdd1cc8b Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期四, 27 七月 2023 13:52:08 +0800
Subject: [PATCH] bugfix 猫眼呼叫问题修复

---
 EZSDK/EZSDK/EZ/Global/EZHttpUtil.m |   81 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m b/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
index e258090..f0aadb2 100644
--- a/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
+++ b/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
@@ -30,6 +30,10 @@
 #define API_POST_EZ_DeleteAlarmMes @"/home-wisdom/platform/yingshi/alarm/delete"//鍒犻櫎鎶ヨ娑堟伅
 #define API_POST_EZ_ReadAlarmMes @"/home-wisdom/platform/yingshi/alarm/updateChecked"//鏍囪鎶ヨ娑堟伅宸茶
 
+#define API_POST_EZ_GetCoverSwitchStaus @"/home-wisdom/platform/yingshi/getCoverSwitchStatus"//鑾峰彇钀ょ煶闀滃ご閬斀寮�鍏崇姸鎬�
+#define API_POST_EZ_GetCoverSwitch @"/home-wisdom/platform/yingshi/coverSwitch"//璁剧疆钀ょ煶闀滃ご閬斀寮�鍏�
+#define AOI_POST_EZ_UpdateAnswerStatus @"/home-wisdom/platform/yingshi/lock/updateAnswerStatus" // 鏇存敼闂ㄩ搩閫氳瘽鐘舵��(鎺ュ惉鍜屾湭鎺�)
+
 #pragma mark APP_KEY
 #define APP_KEY @"HDL-HOME-APP-TEST"
 #define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
@@ -421,6 +425,82 @@
     }];
 }
 
+/**
+ *  @since 鑾峰彇闀滃ご闅愮閬斀鐘舵��
+ *  @param deviceSerial   璁惧搴忓垪鍙�
+ *  @param completion   鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)getCoverSwitchStatus:(NSString *)deviceSerial
+                  completion:(void (^)(ResponseData *responseData))completion {
+    //璁剧疆璇锋眰鍙傛暟
+    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+    [parameters setValue:deviceSerial forKey:@"deviceSerial"];
+    [parameters setValue:@(1) forKey:@"platform"];
+    [parameters setValue:[NSString stringWithFormat:@"%@",[GlobalKit shareKit].hdlAppKey] forKey:@"appKey"];
+    [parameters setValue:@([[GlobalKit shareKit].hdlHomeId integerValue]) forKey:@"homeId"];
+    
+    parameters = [self GetSignRequestDictionary:parameters];
+    
+    NSLog(@"鑾峰彇璁惧娑堟伅鍙傛暟锛�%@",parameters);
+    
+    [self requestHttpsPost:API_POST_EZ_GetCoverSwitchStaus parameters:parameters completion:^(ResponseData *responseData) {
+        if (completion) {
+            completion (responseData);
+        }
+    }];
+}
+
+/**
+ *  @since 鏇存柊鎺ュ惉鐘舵��
+ *  @param msgId   娑堟伅id
+ *  @param answerStatus 鎺ュ惉鐘舵�侊紙answer 宸叉帴鍚�乶o_answer 鏈帴鍚級
+ *  @param completion   鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)updateAnswerStatusWithMsgId:(NSString *)msgId
+                       answerStatus:(NSString *)answerStatus
+                  completion:(void (^)(ResponseData *responseData))completion {
+    //璁剧疆璇锋眰鍙傛暟
+    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+    [parameters setValue:msgId forKey:@"msgId"];
+    [parameters setValue:answerStatus forKey:@"answerStatus"];
+    
+    parameters = [self GetSignRequestDictionary:parameters];
+    
+    [self requestHttpsPost:AOI_POST_EZ_UpdateAnswerStatus parameters:parameters completion:^(ResponseData *responseData) {
+        if (completion) {
+            completion (responseData);
+        }
+    }];
+}
+
+/**
+ *  @since 璁剧疆闀滃ご闅愮閬斀鐘舵��
+ *  @param deviceSerial   璁惧搴忓垪鍙�
+ *  @param enable   闅愮閬斀鐘舵��
+ *  @param completion   鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)coverSwitchStatus:(NSString *)deviceSerial
+                      enable:(NSInteger)enable
+                  completion:(void (^)(ResponseData *responseData))completion {
+    //璁剧疆璇锋眰鍙傛暟
+    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+    [parameters setValue:deviceSerial forKey:@"deviceSerial"];
+    [parameters setValue:@(enable) forKey:@"enable"];
+    [parameters setValue:@(1) forKey:@"platform"];
+    [parameters setValue:[NSString stringWithFormat:@"%@",[GlobalKit shareKit].hdlAppKey] forKey:@"appKey"];
+    [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"];
+    
+    parameters = [self GetSignRequestDictionary:parameters];
+    
+    NSLog(@"鑾峰彇璁惧娑堟伅鍙傛暟锛�%@",parameters);
+    
+    [self requestHttpsPost:API_POST_EZ_GetCoverSwitch parameters:parameters completion:^(ResponseData *responseData) {
+        if (completion) {
+            completion (responseData);
+        }
+    }];
+}
+
 /// 鍒锋柊token
 /// @param block 缁撴灉
 - (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
@@ -501,6 +581,7 @@
         URL = TestRequestHttpsHost;
     }
     URL = [NSString stringWithFormat:@"%@%@", URL, apiPath];
+    NSLog(@"############鎺ュ彛璇锋眰url锛�%@", URL);
     
 //    NSURLSessionDataTask * task=nil;
     AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];

--
Gitblit v1.8.0