| | |
| | | #import <Foundation/Foundation.h> |
| | | #import <CommonCrypto/CommonDigest.h> |
| | | #import "AFNetworking.h" |
| | | #import "YYModel.h" |
| | | |
| | | #define TestRequestHttpsHost @"https://test-gz.hdlcontrol.com" |
| | | #pragma mark API |
| | |
| | | #define API_POST_EZ_ChildDelDevice @"/home-wisdom/platform/yingshi/child/deleteDevice" |
| | | #define API_POST_EZ_RefreshToken @"/smart-footstone/member/oauth/login" |
| | | |
| | | #define API_POST_EZ_GetAlarmList @"/home-wisdom/platform/yingshi/alarm/records"//获取报警消息 |
| | | #define API_POST_EZ_DeleteAlarmMes @"/home-wisdom/platform/yingshi/alarm/delete"//删除报警消息 |
| | | #define API_POST_EZ_ReadAlarmMes @"/home-wisdom/platform/yingshi/alarm/updateChecked"//标记报警消息已读 |
| | | |
| | | #pragma mark APP_KEY |
| | | #define APP_KEY @"HDL-HOME-APP-TEST" |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据设备序列号获取告警信息列表 |
| | | */ |
| | | - (void)getAlarmList:(NSString *)deviceSerial |
| | | pageNo:(NSInteger)pageNo |
| | | pageSize:(NSInteger)pageSize |
| | | completion:(void (^)(ResponseData *responseData))completion{ |
| | | |
| | | //1.设置请求参数 |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue:deviceSerial forKey:@"deviceSerial"]; |
| | | [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; |
| | | [parameters setValue:[NSString stringWithFormat:@"%ld",(long)pageSize] forKey:@"pageSize"]; |
| | | [parameters setValue:[NSString stringWithFormat:@"%ld",(long)pageNo] forKey:@"pageNo"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | NSLog(@"HDLpageNo:%ld",(long)pageNo); |
| | | [self requestHttpsPost:API_POST_EZ_GetAlarmList parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (completion) { |
| | | completion (responseData); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除报警记录 |
| | | */ |
| | | - (void)deleteAlarmMessage:(NSArray *)alarmIds |
| | | completion:(void (^)(ResponseData *responseData))completion{ |
| | | |
| | | //1.设置请求参数 |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue:[alarmIds yy_modelToJSONObject] forKey:@"alarmIds"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_DeleteAlarmMes parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (completion) { |
| | | completion (responseData); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量标记报警记录已读 |
| | | */ |
| | | - (void)readAlarmMessage:(NSArray *)alarmIds |
| | | completion:(void (^)(ResponseData *responseData))completion{ |
| | | |
| | | //1.设置请求参数 |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue:@"1" forKey:@"isChecked"]; |
| | | [parameters setValue:[alarmIds yy_modelToJSONObject] forKey:@"alarmIds"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_ReadAlarmMes parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (completion) { |
| | | completion (responseData); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | |
| | | /// 刷新token |
| | | /// @param block 结果 |
| | |
| | | if (block) { |
| | | if (responseData) { |
| | | if(responseData.success){ |
| | | [EZSDK setHDlAccessToken: |
| | | [[EZSDK sharedInstance] setHDlAccessToken: |
| | | [NSString stringWithFormat:@"%@%@",responseData.data[@"headerPrefix"], responseData.data[@"accessToken"]] |
| | | refreshToken:responseData.data[@"refreshToken"]]; |
| | | |