Skip to content

Commit d4b469c

Browse files
committed
讨论删除评论 api 改动 - app
1 parent 718f964 commit d4b469c

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

Coding_iOS/Controllers/TopicDetailViewController.m

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,19 +404,21 @@ - (void)doCommentToTopic:(ProjectTopic *)toComment sender:(id)sender
404404
- (void)deleteTopic:(ProjectTopic *)curTopic isComment:(BOOL)isC{
405405
if (curTopic) {
406406
__weak typeof(self) weakSelf = self;
407-
[[Coding_NetAPIManager sharedManager] request_ProjectTopic_Delete_WithObj:curTopic andBlock:^(id data, NSError *error) {
408-
if (data) {
409-
if (isC) {
410-
[weakSelf.curTopic.comments.list removeObject:_toComment];
411-
[weakSelf.myTableView reloadData];
412-
}else{
407+
if (!isC) {
408+
[[Coding_NetAPIManager sharedManager] request_ProjectTopic_Delete_WithObj:curTopic andBlock:^(id data, NSError *error) {
409+
if (data) {
413410
if (weakSelf.deleteTopicBlock) {
414411
weakSelf.deleteTopicBlock(weakSelf.curTopic);
415412
}
416413
[weakSelf.navigationController popViewControllerAnimated:YES];
417414
}
418-
}
419-
}];
415+
}];
416+
}else{
417+
[[Coding_NetAPIManager sharedManager] request_ProjectTopicComment_Delete_WithObj:curTopic projectId:_curTopic.project.id andBlock:^(id data, NSError *error) {
418+
[weakSelf.curTopic.comments.list removeObject:_toComment];
419+
[weakSelf.myTableView reloadData];
420+
}];
421+
}
420422
}
421423
}
422424

Coding_iOS/Models/ProjectTopic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@interface ProjectTopic : NSObject
1818

19-
@property (readwrite, nonatomic, strong) NSNumber *id, *child_count, *current_user_role_id, *owner_id, *project_id, *parent_id, *number,*resource_id;
19+
@property (readwrite, nonatomic, strong) NSNumber *id, *child_count, *current_user_role_id, *owner_id, *project_id, *parent_id, *number,*resource_id, *topic_id;
2020
@property (readwrite, nonatomic, strong) NSDate *created_at;
2121
@property (readwrite, nonatomic, strong) NSDate *updated_at;
2222
@property (readwrite, nonatomic, strong) NSString *title, *content, *path,*contentStr;

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ typedef NS_ENUM(NSInteger, PurposeType) {
166166
- (void)request_Comments_WithProjectTpoic:(ProjectTopic *)proTopic andBlock:(void (^)(id data, NSError *error))block;
167167
- (void)request_DoComment_WithProjectTpoic:(ProjectTopic *)proTopic andBlock:(void (^)(id data, NSError *error))block;
168168
- (void)request_ProjectTopic_Delete_WithObj:(ProjectTopic *)proTopic andBlock:(void (^)(id data, NSError *error))block;
169+
- (void)request_ProjectTopicComment_Delete_WithObj:(ProjectTopic *)proTopic projectId:(NSNumber *)projectId andBlock:(void (^)(id data, NSError *error))block;
169170
- (void)request_ChangeWatcher:(User *)watcher ofTopic:(ProjectTopic *)proTopic andBlock:(void (^)(id data, NSError *error))block;
170171

171172
- (void)request_ModifyProjectTpoicLabel:(ProjectTopic *)proTopic

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,20 @@ - (void)request_ProjectTopic_Delete_WithObj:(ProjectTopic *)proTopic andBlock:(v
15461546
}
15471547
}];
15481548
}
1549+
1550+
- (void)request_ProjectTopicComment_Delete_WithObj:(ProjectTopic *)proTopic projectId:(NSNumber *)projectId andBlock:(void (^)(id data, NSError *error))block{
1551+
NSString *path = [NSString stringWithFormat:@"api/project/%@/topic/%@/comment/%@", projectId, proTopic.topic_id, proTopic.id];
1552+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:path withParams:nil withMethodType:Delete andBlock:^(id data, NSError *error) {
1553+
if (data) {
1554+
[MobClick event:kUmeng_Event_Request_ActionOfServer label:@"讨论评论_删除"];
1555+
1556+
block(data, nil);
1557+
}else{
1558+
block(nil, error);
1559+
}
1560+
}];
1561+
}
1562+
15491563
- (void)request_ChangeWatcher:(User *)watcher ofTopic:(ProjectTopic *)proTopic andBlock:(void (^)(id data, NSError *error))block{
15501564
NSString *path = [NSString stringWithFormat:@"api/topic/%@/user/%@/watch", proTopic.id.stringValue, watcher.global_key];
15511565
User *hasWatcher = [proTopic hasWatcher:watcher];

0 commit comments

Comments
 (0)