本地版本测试版-9.8.5
This commit is contained in:
@@ -268,20 +268,25 @@ extern BOOL launchedByNotification;
|
||||
[SVProgressHUD show];
|
||||
self.pushId = @"";
|
||||
UserModel*userModel=[dataContorl getUserInfo];
|
||||
NSArray *keys = @[@"pushId",@"userId",@"firstResult",@"pageSize"];
|
||||
NSArray *values = @[self.pushId,userModel.userId,@"0",@"999"];
|
||||
|
||||
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Url keys:keys values:values success:^(NSDictionary *successDic) {
|
||||
|
||||
NSString *totalCount = [successDic objectForKey:@"total"];
|
||||
NSArray *dataArray = [successDic objectForKey:@"data"];
|
||||
NSDictionary *params = @{@"pushId":self.pushId,
|
||||
@"userId":userModel.userId,
|
||||
@"firstResult":@(0),
|
||||
@"pageSize":@(999)
|
||||
};
|
||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_Url params:params success:^(id response) {
|
||||
[SVProgressHUD dismiss];
|
||||
if (response) {
|
||||
id resault=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
|
||||
NSString *totalCount = [resault objectForKey:@"total"];
|
||||
NSArray *dataArray = [resault objectForKey:@"data"];
|
||||
if ([totalCount integerValue]>0) {
|
||||
NSMutableArray *newMessageArray = InitObject(NSMutableArray);
|
||||
NSMutableArray *oldMessageArray = InitObject(NSMutableArray);
|
||||
for (int i=0; i<dataArray.count; i++) {
|
||||
PushmessageModel *messageModel = [PushmessageModel yy_modelWithJSON:[dataArray objectAtIndex:i]];
|
||||
[messageModel getCellHeight];
|
||||
|
||||
|
||||
if ([messageModel.isRead integerValue]==1) {//未读消息
|
||||
[newMessageArray addObject:messageModel];
|
||||
}else{
|
||||
@@ -292,12 +297,11 @@ extern BOOL launchedByNotification;
|
||||
[self.dataSource addObject:oldMessageArray];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
|
||||
|
||||
} failure:^(NSDictionary *errorDic) {
|
||||
|
||||
}
|
||||
} failure:^(NSError *err) {
|
||||
[SVProgressHUD dismiss];
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
//发送已读记录
|
||||
-(void)postReadMessageRequestWithIndexPath:(NSIndexPath *)indexPath{
|
||||
@@ -305,20 +309,21 @@ extern BOOL launchedByNotification;
|
||||
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
if([model.isRead integerValue]==1)//未读消息
|
||||
{
|
||||
|
||||
NSArray *keys = @[@"userId",@"pushId"];
|
||||
NSArray *values = @[userModel.userId,self.pushId];
|
||||
|
||||
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Readed keys:keys values:values success:^(NSDictionary *successDic) {
|
||||
|
||||
NSString *result = [successDic objectForKey:RESPONSE_CODE];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
//已读
|
||||
}else{
|
||||
|
||||
}
|
||||
} failure:^(NSDictionary *errorDic) {
|
||||
|
||||
NSDictionary *params = @{@"userId":userModel.userId,
|
||||
@"pushId":model.pushId,
|
||||
};
|
||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_Readed params:params success:^(id response) {
|
||||
if (response) {
|
||||
id resault=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString *result = [resault objectForKey:RESPONSE_CODE];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
//已读
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
} failure:^(NSError *err) {
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
@@ -329,29 +334,27 @@ extern BOOL launchedByNotification;
|
||||
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
NSMutableDictionary *deleteDic = InitObject(NSMutableDictionary);
|
||||
[deleteDic setValue:model.pushId forKey:@"pushId"];
|
||||
|
||||
NSArray *keys = @[@"userId",@"pushIds"];
|
||||
NSArray *values = @[userModel.userId,[CommonUtils arrayToJSONString:@[deleteDic]]];
|
||||
|
||||
NSDictionary *params = @{@"userId":userModel.userId,
|
||||
@"pushIds":[CommonUtils arrayToJSONString:@[deleteDic]]
|
||||
};
|
||||
[SVProgressHUD show];
|
||||
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Delete_Url keys:keys values:values success:^(NSDictionary *successDic) {
|
||||
|
||||
NSString *result = [successDic objectForKey:RESPONSE_CODE];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
[[self.dataSource objectAtIndex:indexPath.section] removeObjectAtIndex:indexPath.row];
|
||||
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
// //刷新页面
|
||||
// [self.tableView reloadData];
|
||||
// [self.tableView scrollsToTop];
|
||||
}else{
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_Delete_Url params:params success:^(id response) {
|
||||
if (response) {
|
||||
id resault=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString *result = [resault objectForKey:RESPONSE_CODE];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
[[self.dataSource objectAtIndex:indexPath.section] removeObjectAtIndex:indexPath.row];
|
||||
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
|
||||
// //刷新页面
|
||||
// [self.tableView reloadData];
|
||||
// [self.tableView scrollsToTop];
|
||||
}else{
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
}
|
||||
}
|
||||
} failure:^(NSDictionary *errorDic) {
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
// self.deleteBtn.selected = NO;
|
||||
// [self.deleteView setHidden:YES];
|
||||
// [self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
// make.bottom.mas_equalTo(self.view);
|
||||
// }];
|
||||
} failure:^(NSError *err) {
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
}];
|
||||
}
|
||||
//删除接口(多选删除)
|
||||
@@ -364,48 +367,47 @@ extern BOOL launchedByNotification;
|
||||
[deleteDic setValue:pushId forKey:@"pushId"];
|
||||
[deleteArray addObject:deleteDic];
|
||||
}
|
||||
NSArray *keys = @[@"userId",@"pushIds"];
|
||||
NSArray *values = @[userModel.userId,[CommonUtils arrayToJSONString:deleteArray]];
|
||||
NSDictionary *params = @{@"userId":userModel.userId,
|
||||
@"pushIds":[CommonUtils arrayToJSONString:deleteArray]
|
||||
};
|
||||
[SVProgressHUD show];
|
||||
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Delete_Url keys:keys values:values success:^(NSDictionary *successDic) {
|
||||
|
||||
NSString *result = [successDic objectForKey:RESPONSE_CODE];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
self.deleteBtn.selected = NO;
|
||||
for (int i=0;i< self.dataSource.count;i++) {
|
||||
NSArray *arr = [self.dataSource objectAtIndex:i];
|
||||
NSMutableArray *newArray = InitObject(NSMutableArray);
|
||||
for (int j=0; j<arr.count; j++) {
|
||||
PushmessageModel *model = [arr objectAtIndex:j];
|
||||
if ([self.deleteArray containsObject:model.pushId]) {
|
||||
|
||||
}else{
|
||||
[newArray addObject:model];
|
||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_Delete_Url params:params success:^(id response) {
|
||||
if (response) {
|
||||
id successDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString *result = [successDic objectForKey:RESPONSE_CODE];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
self.deleteBtn.selected = NO;
|
||||
for (int i=0;i< self.dataSource.count;i++) {
|
||||
NSArray *arr = [self.dataSource objectAtIndex:i];
|
||||
NSMutableArray *newArray = InitObject(NSMutableArray);
|
||||
for (int j=0; j<arr.count; j++) {
|
||||
PushmessageModel *model = [arr objectAtIndex:j];
|
||||
if ([self.deleteArray containsObject:model.pushId]) {
|
||||
|
||||
}else{
|
||||
[newArray addObject:model];
|
||||
}
|
||||
}
|
||||
[self.dataSource setObject:newArray atIndexedSubscript:i];
|
||||
}
|
||||
[self.dataSource setObject:newArray atIndexedSubscript:i];
|
||||
//走删除接口之后,清空删除内容数组
|
||||
[self.deleteArray removeAllObjects];
|
||||
self.isDelteAll = NO;
|
||||
[self.deleteView setHidden:YES];
|
||||
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
self.isShowDelete = NO;
|
||||
//刷新页面
|
||||
[self.tableView reloadData];
|
||||
[self.tableView scrollsToTop];
|
||||
}else{
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
}
|
||||
//走删除接口之后,清空删除内容数组
|
||||
[self.deleteArray removeAllObjects];
|
||||
self.isDelteAll = NO;
|
||||
[self.deleteView setHidden:YES];
|
||||
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
self.isShowDelete = NO;
|
||||
//刷新页面
|
||||
[self.tableView reloadData];
|
||||
[self.tableView scrollsToTop];
|
||||
}else{
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
}
|
||||
} failure:^(NSDictionary *errorDic) {
|
||||
} failure:^(NSError *err) {
|
||||
[SVProgressHUD showInfoWithStatus:@"删除失败"];
|
||||
// self.deleteBtn.selected = NO;
|
||||
// [self.deleteView setHidden:YES];
|
||||
// [self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
// make.bottom.mas_equalTo(self.view);
|
||||
// }];
|
||||
|
||||
}];
|
||||
}
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
|
||||
@@ -138,24 +138,25 @@ Assign NSInteger messageCount;//消息个数
|
||||
//获取未读消息个数
|
||||
-(void)getMessageCount{
|
||||
|
||||
UserModel*userModel=[dataContorl getUserInfo];
|
||||
NSArray *keys = @[@"userId"];
|
||||
NSArray *values = @[userModel.userId];
|
||||
UserModel*userModel=[dataContorl getUserInfo];
|
||||
|
||||
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_UnReadCount keys:keys values:values success:^(NSDictionary *successDic) {
|
||||
|
||||
NSDictionary *params = @{@"userId":userModel.userId
|
||||
};
|
||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_UnReadCount params:params success:^(id response) {
|
||||
if (response) {
|
||||
id successDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString *result = [successDic objectForKey:RESPONSE_CODE];
|
||||
NSDictionary *dic = [successDic objectForKey:RESPONSE_DATA];
|
||||
if ([result integerValue]==kReqSuccess) {
|
||||
|
||||
|
||||
NSString *count = [dic objectForKey:@"messageNoReadCount"];
|
||||
self.messageCount = [count integerValue];
|
||||
}
|
||||
[self setRedViewData];
|
||||
|
||||
} failure:^(NSDictionary *errorDic) {
|
||||
|
||||
}];
|
||||
}
|
||||
} failure:^(NSError *err) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - 首页广告位
|
||||
|
||||
|
||||
@@ -295,13 +295,14 @@
|
||||
//登陆成功之后,验证当前页面devicetoken是否上送成功,如果还未上送,则重新上送devicetoken
|
||||
if (![[NSUserDefaults standardUserDefaults] boolForKey:is_Bind_DeviceToken]) {
|
||||
UserModel *model=[[UserModel alloc] initWithDict:DataDic];
|
||||
NSArray *keys = @[@"deviceId",@"userId"];
|
||||
NSArray *values = @[[FuncUserDefault strForKey:kDeviceToken],model.userId];
|
||||
|
||||
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_BindDevice_Url keys:keys values:values success:^(NSDictionary *successDic){
|
||||
NSDictionary *params = @{@"deviceId":[FuncUserDefault strForKey:kDeviceToken],
|
||||
@"userId":model.userId,
|
||||
@"phoneType":@"iOS"
|
||||
};
|
||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_BindDevice_Url params:params success:^(id response) {
|
||||
//绑定成功
|
||||
[FuncUserDefault setBool:YES key:is_Bind_DeviceToken];//已经上送了本机的devicetoken
|
||||
} failure:^(NSDictionary *errorDic) {
|
||||
} failure:^(NSError *err) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user