- 1. 授权页面点击同意或者忽略返回成功时向对方发通知<#import “CrowdfundingApplyCell.h”>
- 2. 我的私信页面对收到的信息进行处理<#import “ChatListViewController.h”>
- 3. 我的私信详情页收到信息进行处理<#import “ChatViewController.h”>
- 4. 在各个cell中的点击事件中,添加众筹点击事件<#import “ChatViewController.h”>
1. 授权页面点击同意或者忽略返回成功时向对方发通知<#import “CrowdfundingApplyCell.h”>
//直接在消息中初始化发送消息即可
_extParams = [[MessageParams alloc] init];
_extParams.studioMsgFlag = YES;
_extParams.job = @"";
_extParams.jobGroup = @"";
[ChatSendHelper sendTextMessageWithString:[NSString stringWithFormat:@"YouAreTheBest您的众筹授权申请已通过%@",self.model.CrowdFundingID] toUsername:[NSString stringWithFormat:@"%d",self.model.UserID] isChatGroup:NO requireEncryption:NO ext:_extParams];
2. 我的私信页面对收到的信息进行处理<#import “ChatListViewController.h”>
if (cell.detailMsg.length > 24) {
NSString *cutString = [cell.detailMsg substringToIndex:24];
if ([cutString isEqualToString:@"YouAreTheBest您的众筹授权申请已通过"]) {
cell.detailMsg = @"[众筹授权]";
} else if ([cutString isEqualToString:@"YouAreTheBest您的众筹授权申请已被忽"]) {
cell.detailMsg = @"[众筹授权]";
}
}
3. 我的私信详情页收到信息进行处理<#import “ChatViewController.h”>
//model中添加众筹相关参数
@property (nonatomic,strong) NSString *crowdFundingID; //众筹ID
@property (nonatomic) BOOL isCrowdFunding; //众筹判断
model.headImageURL = [NSURL URLWithString:_userHeaderUrl];
#pragma mark 是发送者的时候对众筹授权状态进行判断
if (model.content.length > 24) {
NSString *cutString = [model.content substringToIndex:24];
if ([cutString isEqualToString:@"YouAreTheBest您的众筹授权申请已通过"]) {
model.content = @"已同意对方的请求";
} else if ([cutString isEqualToString:@"YouAreTheBest您的众筹授权申请已被忽"]) {
model.content = @"已忽略对方请求";
}
}
#pragma mark 是接收者的时候对众筹授权状态进行判断
if (model.content.length > 24) {
NSString *cutString = [model.content substringToIndex:24];
if ([cutString isEqualToString:@"YouAreTheBest您的众筹授权申请已通过"]) {
model.crowdFundingID = [model.content substringFromIndex:24];
model.isCrowdFunding = YES;
model.content = @"您的众筹授权申请已通过";
} else if ([cutString isEqualToString:@"YouAreTheBest您的众筹授权申请已被忽"]) {
model.crowdFundingID = [model.content substringFromIndex:33];
model.isCrowdFunding = YES;
model.content = @"您的众筹授权申请已被忽略,可再次进行申请";
}
}
4. 在各个cell中的点击事件中,添加众筹点击事件<#import “ChatViewController.h”>
#pragma mark 获取每个cell中的Model,根据数据进行判断类型
MessageModel *model = [userInfo objectForKey:KMESSAGEKEY];
if ([eventName isEqualToString:kRouterEventTextURLTapEventName]) {
NSString *url =[userInfo objectForKey:@"url"];
if (url !=nil) {
[self chatTextCellUrlPressed:[userInfo objectForKey:@"url"]];
} else if (model.isCrowdFunding) {
#pragma mark 在文字类型中添加众筹条点击事件
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = barButtonItem;
if (model.crowdFundingID.length) {
ItemVC *itemVC = [[ItemVC alloc] init];
[self setHidesBottomBarWhenPushed:YES];
itemVC.crowdFundingID = model.crowdFundingID;
[self.navigationController pushViewController:itemVC animated:YES];
} else {
TTAlert(@"恭喜您获取了特权,您可以在相关页面看到更多信息了");
}
}