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 | 122 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 120 insertions(+), 2 deletions(-)
diff --git a/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m b/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
index f0aadb2..bf072a1 100644
--- a/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
+++ b/EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
@@ -33,6 +33,10 @@
#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"
@@ -501,6 +505,111 @@
}];
}
+/**
+ * @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{
@@ -627,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) {
@@ -648,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