| | |
| | | |
| | | #define TestRequestHttpsHost @"https://test-gz.hdlcontrol.com" |
| | | #pragma mark API |
| | | #define API_POST_EZ_AddDevice @"/home-wisdom/platform/childAddDevice" |
| | | #define API_POST_EZ_GetChildToken @"/home-wisdom/platform/childToken" |
| | | #define API_POST_EZ_ChildDelDevice @"/home-wisdom/platform/childDelDevice" |
| | | #define API_POST_EZ_AddDevice @"/home-wisdom/platform/yingshi/child/addDevice" |
| | | #define API_POST_EZ_GetChildToken @"/home-wisdom/platform/yingshi/child/token" |
| | | #define API_POST_EZ_ChildDelDevice @"/home-wisdom/platform/yingshi/child/deleteDevice" |
| | | #define API_POST_EZ_RefreshToken @"/smart-footstone/member/oauth/login" |
| | | |
| | | |
| | |
| | | //2.设置请求参数 |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue: [NSString stringWithFormat:@"%d", [GlobalKit shareKit].hdlPlatform] forKey:@"platform"]; |
| | | [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_GetChildToken parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (block) { |
| | | NSString * token = @""; |
| | | if(responseData.success){ |
| | | token = responseData.data[@"accessToken"]; |
| | | // token = responseData.data[@"accessToken"]; |
| | | token = [NSString stringWithFormat:@"%@",responseData.data]; |
| | | } |
| | | block(token); |
| | | } |
| | |
| | | [parameters setValue:deviceSerial forKey:@"deviceSerial"]; |
| | | [parameters setValue:verifyCode forKey:@"validateCode"]; |
| | | [parameters setValue: [NSString stringWithFormat:@"%d",[GlobalKit shareKit].hdlPlatform] forKey:@"platform"]; |
| | | [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_AddDevice parameters:parameters completion:^(ResponseData *responseData) { |
| | | [self requestHttpsPost:API_POST_EZ_AddDevice parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (completion) { |
| | | completion (responseData); |
| | | } |
| | |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue:deviceSerial forKey:@"deviceSerial"]; |
| | | [parameters setValue: [NSString stringWithFormat:@"%d",[GlobalKit shareKit].hdlPlatform] forKey:@"platform"]; |
| | | [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_ChildDelDevice parameters:parameters completion:^(ResponseData *responseData) { |
| | |
| | | NSString *newString = @""; |
| | | for(NSString *key in sortKeyArray){ |
| | | if(params[key] != NULL){ |
| | | NSString *valueStr = params[key]; |
| | | //Key对应的value强转为NSString |
| | | NSString *valueStr = [NSString stringWithFormat:@"%@",[params objectForKey:key]]; |
| | | //检测当前参数是否需要参与校验 |
| | | if([self IfValueNeedSign:valueStr]){ |
| | | newString = [newString stringByAppendingString:[NSString stringWithFormat:@"%@=%@&", key,valueStr]]; |
| | |
| | | if (( [self stringIsNullOrEmpty:valueStr])//判空字符 |
| | | || ([[valueStr substringToIndex:1] isEqual:@"{"])//判断是否为对象 |
| | | || ([[valueStr substringToIndex:1] isEqual:@"["])//判断是否为数组 |
| | | || ([[valueStr substringToIndex:1] isEqual:@"("])//判断是否为数组 |
| | | ) { |
| | | |
| | | // HDLSDKLog(@"不校验: %@",valueStr); |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - 修改记录 |
| | | //2021-07-07 |
| | | //V1.1.3 |
| | | //1.替换为新接口,根据homeId注册萤石子账号方案。 |