// // WIFIModel.m // tongxin // // Created by Apple on 2020/4/10. // Copyright © 2020 xTT. All rights reserved. // #import "WIFIModel.h" #import "User.h" #import "Device.h" @implementation WIFIModel + (void)getWIFIDataSuccess:(void (^)(WIFIModel *model))success failure:(void (^)(NSError *error))failure{ NSString *urlStr = [MyHttp getURL:HTTP_DEVICES_WIFI objArr:@[cUser.cDevice]]; [xMyHttp URL:urlStr method:@"GET" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) { if ([responseObject[@"code"] intValue] == HTTP_SUCCESS) { WIFIModel *model = [WIFIModel mj_objectWithKeyValues:responseObject]; success(model); } } failure:^(NSURLSessionDataTask *task, NSError *error) { if (failure) { failure(error); } }]; } + (void)getWIFIDataListSuccess:(void (^)(WIFIModel *model))success failure:(void (^)(NSError *error))failure { NSMutableDictionary *param = self.mj_keyValues; xLog(@"WIFI设置 POST 提交的参数: %@", param); NSString *urlStr = [MyHttp getURL:HTTP_DEVICES_WIFI_LIST objArr:@[cUser.cDevice]]; [xMyHttp URL:urlStr method:@"POST" parameters:param success:^(NSURLSessionDataTask *task, id responseObject) { if ([responseObject[@"code"] intValue] == HTTP_SUCCESS) { success(responseObject); } } failure:^(NSURLSessionDataTask *task, NSError *error) { if (failure) { failure(error); } }]; } - (void)postWIFIDataSuccess:(void (^)(id responseObject))success failure:(void (^)(NSError *error))failure{ NSMutableDictionary *param = self.mj_keyValues; xLog(@"WIFI设置 POST 提交的参数: %@", param); NSString *urlStr = [MyHttp getURL:HTTP_DEVICES_WIFI objArr:@[cUser.cDevice]]; [xMyHttp URL:urlStr method:@"POST" parameters:param success:^(NSURLSessionDataTask *task, id responseObject) { if ([responseObject[@"code"] intValue] == HTTP_SUCCESS) { success(responseObject); } } failure:^(NSURLSessionDataTask *task, NSError *error) { if (failure) { failure(error); } }]; } @end