IOS-返回接口相关的

2015-12-11  本文已影响240人  Roger_单

    NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
NSDictionary *userInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserInfo"];
    [dic setValue:userInfo[@"supermaketName"] forKey:@"supermaketName"];
    [dic setValue:userInfo[@"tasteCategory"] forKey:@"tasteCategory"];
    [dic setValue:@"0411" forKey:@"ctiyId"];
    [dic setValue:[NSNumber numberWithDouble:121.517977] forKey:@"lng"];
    [dic setValue:[NSNumber numberWithDouble:38.8496481] forKey:@"lat"];
    [dic setValue:userInfo[@"type"] forKey:@"type"];
    [dic setValue:@"1" forKey:@"showType"];
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[[SetRequest sharedInstance]postRequestWithURL:URL(searchSupermarketList)
    postParems:dic content:^(NetWorkModel *model){
        [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
        if(model.error){
            [[UIToast makeText:@"发送失败"] show];
        }else{
            NSLog(@"发送搜索请求失败");
            if ([model.responseDic[@"error_code"] intValue] == 0) {
                //  [[UIToast makeText:@"搜索成功,请查收!"] show];
                _dataSource = [[NSArray alloc]init];
                if (![model.responseDic[@"restaurantList"] isKindOfClass:[NSNull class]]) {
                    _dataSource = model.responseDic[@"restaurantList"];
                }
                [_tableView reloadData];
            }else{
                [[UIToast makeText:@"请求失败"] show];
            }
        }
    }];
上一篇下一篇

猜你喜欢

热点阅读