发送POST请求:
NSMutableDictionary *postDict = [[NSMutableDictionary alloc] init];
postDict[@"uid"] = [SingleManager shareManager].uid;
postDict[@"groupid"] = self.groupID;
postDict[@"service"] = @"Group.delGroup";
//解散群
[self POST:@"Group.delGroup" parameters:postDict withMessage:@"正在加载" success:^(id responseObject) {
if (responseObject) {
NSDictionary *data = responseObject[@"data"];
if ([data[@"code"] integerValue]==1){
//创建群组成功
[SVProgressHUD dismiss];
[self.navigationController popToViewController:groupVC animated:YES];
}else{
}
}
}];
解析的时候 如果是字典就是说是一页显示的那种 就用
_groupModel = [MyGroupModel mj_objectWithKeyValues:data[@"info"]]; 创建一个model去接收就行了
字典数组 -> 模型数组
如果是tableView用来显示数据的也就是数组类型的 self.groupUserlistsArr = [SJZGroupUserlist mj_objectArrayWithKeyValuesArray:dic[@"groupUserlist"]];
创建一个数组去接收 这个模型数组
然后赋值就是了
重写模型的set方法进行赋值就是了 恩恩
-(void)setGroupDataModel:(SJZGroupDataModel *)groupDataModel{
_groupDataModel =groupDataModel;
[self.headImageView sd_setImageWithURL:[NSURL URLWithString:_groupDataModel.avatar] placeholderImage:[UIImage imageNamed:@"defaultImage.png"]];
self.titleLabel.text = _groupDataModel.title;
self.contnetLabel.text = _groupDataModel.message;
NSString *timedata =[NSString stringWithFormat:@"%ld",(long)_groupDataModel.lastdateline];
self.timeLabel.text = [[SingleManager shareManager]changeDateStrToDateStrWithInDateFormate:nil withOutFormate:@"MM-dd" withDateStr:nil withShiJianChuoStr:timedata withDate:nil];
self.mouthLabel.text =[[SingleManager shareManager]changeDateStrToDateStrWithInDateFormate:nil withOutFormate:@"HH:mm" withDateStr:nil withShiJianChuoStr:timedata withDate:nil];
}