From b4e1288a9b63eb820e9c9489c56aac4bf6b31067 Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期三, 18 十二月 2024 14:34:16 +0800
Subject: [PATCH] feature 图片资源更新
---
EZSDK/EZSDK/EZ/Global/EZHttpUtil.m | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 201 insertions(+), 2 deletions(-)
diff --git a/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m b/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
index e258090..bf072a1 100644
--- a/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
+++ b/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
@@ -30,6 +30,14 @@
#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" // 鏇存敼闂ㄩ搩閫氳瘽鐘舵��(鎺ュ惉鍜屾湭鎺�)
+#define API_POST_EZ_GetAiSupportList @"/home-wisdom/platform/yingshi/getAiSupportList"//鑾峰彇鎽勫儚澶存櫤鑳界畻娉曞垪琛ㄥ拰鐘舵��
+#define API_POST_EZ_SetAiSupport @"/home-wisdom/platform/yingshi/setAiSupport"//璁剧疆鎽勫儚澶存櫤鑳界畻娉�
+#define API_POST_EZ_GetDeviceCapacity @"/home-wisdom/platform/yingshi/getDeviceCapacity"//鑾峰彇璁惧鑳藉姏闆�(鑾峰彇鎽勫儚澶村弽杞兘鍔�)
+#define API_POST_EZ_SetPtzMiroor @"/home-wisdom/platform/yingshi/setPtzMiroor"//璁剧疆璁惧浜戝彴闀滃儚(璁剧疆鎽勫儚澶村弽杞兘鍔�)
+
#pragma mark APP_KEY
#define APP_KEY @"HDL-HOME-APP-TEST"
#define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
@@ -421,6 +429,187 @@
}];
}
+/**
+ * @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);
+ }
+ }];
+}
+
+/**
+ * @since 鑾峰彇鎽勫儚澶存櫤鑳界畻娉曞垪琛ㄥ拰鐘舵��
+ * @param deviceSerial 璁惧搴忓垪鍙�
+ * @param completion 鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)getAiSupportDetectionList:(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 forKey:@"homeId"];
+
+ parameters = [self GetSignRequestDictionary:parameters];
+
+ NSLog(@"鑾峰彇璁惧娑堟伅鍙傛暟锛�%@",parameters);
+
+ [self requestHttpsPost:API_POST_EZ_GetAiSupportList parameters:parameters completion:^(ResponseData *responseData) {
+ if (completion) {
+ completion (responseData);
+ }
+ }];
+}
+
+/**
+ * @since 璁剧疆鎽勫儚澶存櫤鑳界畻娉�
+ * @param deviceSerial 璁惧搴忓垪鍙�
+ * @param code 鏅鸿兘绠楁硶缂栫爜
+ * @param completion 鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)setAiSupportDetection:(NSString *)deviceSerial
+ code:(NSString *)code
+ completion:(void (^)(ResponseData *responseData))completion {
+ //璁剧疆璇锋眰鍙傛暟
+ NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+ [parameters setValue:deviceSerial forKey:@"deviceSerial"];
+ [parameters setValue:code forKey:@"code"];
+// [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_SetAiSupport parameters:parameters completion:^(ResponseData *responseData) {
+ if (completion) {
+ completion (responseData);
+ }
+ }];
+}
+
+/**
+ * @since 鑾峰彇璁惧鑳藉姏闆�
+ * @param deviceSerial 璁惧搴忓垪鍙�
+ * @param completion 鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)getDeviceCapacity:(NSString *)deviceSerial
+ completion:(void (^)(ResponseData *responseData))completion {
+ //璁剧疆璇锋眰鍙傛暟
+ NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+ [parameters setValue:deviceSerial forKey:@"deviceSerial"];
+ [parameters setValue:@(1) forKey:@"platform"];
+ [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"];
+
+ parameters = [self GetSignRequestDictionary:parameters];
+
+ NSLog(@"鑾峰彇璁惧鑳藉姏闆嗗弬鏁帮細%@",parameters);
+
+ [self requestHttpsPost:API_POST_EZ_GetDeviceCapacity parameters:parameters completion:^(ResponseData *responseData) {
+ if (completion) {
+ completion (responseData);
+ }
+ }];
+}
+
+/**
+ * @since 璁剧疆璁惧浜戝彴闀滃儚
+ * @param deviceSerial 璁惧搴忓垪鍙�
+ * @param command 鍛戒护 0-涓婁笅锛�1-宸﹀彸锛�2-涓績
+ * @param completion 鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘垚鍔�
+ */
+- (void)setPtzMiroor:(NSString *)deviceSerial
+ command:(NSString *)command
+ completion:(void (^)(ResponseData *responseData))completion {
+ //璁剧疆璇锋眰鍙傛暟
+ NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+ [parameters setValue:deviceSerial forKey:@"deviceSerial"];
+ [parameters setValue:@(1) forKey:@"platform"];
+ [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"];
+ [parameters setValue:command forKey:@"command"];
+
+ parameters = [self GetSignRequestDictionary:parameters];
+
+ NSLog(@"璁剧疆璁惧浜戝彴闀滃儚鍙傛暟锛�%@",parameters);
+
+ [self requestHttpsPost:API_POST_EZ_SetPtzMiroor parameters:parameters completion:^(ResponseData *responseData) {
+ if (completion) {
+ completion (responseData);
+ }
+ }];
+}
+
+
/// 鍒锋柊token
/// @param block 缁撴灉
- (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
@@ -501,6 +690,7 @@
URL = TestRequestHttpsHost;
}
URL = [NSString stringWithFormat:@"%@%@", URL, apiPath];
+ NSLog(@"############鎺ュ彛璇锋眰url锛�%@", URL);
// NSURLSessionDataTask * task=nil;
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
@@ -546,8 +736,17 @@
params =[NSMutableDictionary dictionary];
}
UInt64 recordTime = [[NSDate date] timeIntervalSince1970]*1000;
- [params setValue:APP_KEY forKey:@"appKey"];
+ NSString *hdlServerAppKey = [GlobalKit shareKit].hdlServerAppKey;
+ if (!hdlServerAppKey || hdlServerAppKey.length == 0) {
+ hdlServerAppKey = APP_KEY;
+ }
+ NSString *hdlServerAppSecret = [GlobalKit shareKit].hdlServerAppSecret;
+ if (!hdlServerAppSecret || hdlServerAppSecret.length == 0) {
+ hdlServerAppSecret = SECRET_KEY;
+ }
+ [params setValue:hdlServerAppKey forKey:@"appKey"];
[params setValue:[NSString stringWithFormat:@"%llu",recordTime] forKey:@"timestamp"];
+ NSLog(@"##########APPKEY:%@, SECRETKEY:%@", hdlServerAppKey, hdlServerAppSecret);
//1.瀵筀EY鍗囧簭
NSArray *keyArray = [params allKeys];
NSArray *sortKeyArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
@@ -567,7 +766,7 @@
}
//2.3 鎷兼帴SECRET_KEY
newString = [newString substringToIndex:[newString length] - 1];
- newString = [newString stringByAppendingString: SECRET_KEY];
+ newString = [newString stringByAppendingString: hdlServerAppSecret];
//2.4 MD5杞崲+杞皬鍐�
if([self stringIsNullOrEmpty:newString]){
newString = @"";
--
Gitblit v1.8.0