| | |
| | | } |
| | | else |
| | | { |
| | | [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | // completion:^(NSError *error) { |
| | | // if (error) |
| | | // { |
| | | // [self addErrorProcessWithError:error]; |
| | | // } |
| | | // else |
| | | // { |
| | | // [self successProcess]; |
| | | // } |
| | | // }]; |
| | | [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo |
| | | verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | completion:^(NSError *error) { |
| | | if (error) |
| | | completion:^(ResponseData *responseData) { |
| | | |
| | | if (!responseData.success) |
| | | { |
| | | [self addErrorProcessWithError:error]; |
| | | [self addErrorProcessWithError:responseData]; |
| | | } |
| | | else |
| | | { |
| | | [self successProcess]; |
| | | } |
| | | |
| | | }]; |
| | | |
| | | } |
| | | }]; |
| | | } |
| | |
| | | [self.view makeToast:msg duration:2.0 position:@"center"]; |
| | | } |
| | | |
| | | - (void) addErrorProcessWithError:(NSError *) error |
| | | //- (void) addErrorProcessWithError:(NSError *) error |
| | | //{ |
| | | // NSString *msg = nil; |
| | | // if (error.code == 120010) |
| | | // { |
| | | // msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误"); |
| | | // } |
| | | // else if (error.code == 120020) |
| | | // { |
| | | // msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备"); |
| | | // } |
| | | // else if (error.code == 120022) |
| | | // { |
| | | // msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加"); |
| | | // } |
| | | // else |
| | | // { |
| | | // msg = NSLocalizedString(@"wifi_add_fail", @"添加失败"); |
| | | // } |
| | | // |
| | | // [self.view makeToast:msg duration:2.0 position:@"center"]; |
| | | // self.msgLabel.hidden = YES; |
| | | //} |
| | | |
| | | - (void) addErrorProcessWithError:(ResponseData *)responseData |
| | | { |
| | | NSString *msg = nil; |
| | | if (error.code == 120010) |
| | | if ([responseData.code isEqual: @"20010"]) |
| | | { |
| | | msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误"); |
| | | } |
| | | else if (error.code == 120020) |
| | | else if ([responseData.code isEqual: @"20017"]) |
| | | { |
| | | msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备"); |
| | | } |
| | | else if (error.code == 120022) |
| | | else if ([responseData.code isEqual: @"20013"]) |
| | | { |
| | | msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加"); |
| | | } |