Commit e09ea85b authored by admin's avatar admin

修复response[@"succeed"]

parent ea82248d
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
#define Url_h #define Url_h
// url 测试环境 // url 测试环境
//#define kRedStarURL @"http://218.244.151.129:7580/" #define kRedStarURL @"http://218.244.151.129:7580/"
// 正式环境 // 正式环境
// #define kRedStarURL @"http://219.235.234.225:7580/" // #define kRedStarURL @"http://219.235.234.225:7580/"
// 最新正式环境 // 最新正式环境
#define kRedStarURL @"http://219.235.234.212:7580/" // #define kRedStarURL @"http://219.235.234.212:7580/"
// 检查更新 // 检查更新
#define kCheckUpdateURL @"redstar-server/rest/ipapk?type=ipa" #define kCheckUpdateURL @"redstar-server/rest/ipapk?type=ipa"
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getAnnounceListWithCompletion:^(id response, NSError *error) { [httpClient getAnnounceListWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
NSDictionary *dict = response[@"data"]; NSDictionary *dict = response[@"data"];
NSArray *array = dict[@"records"]; NSArray *array = dict[@"records"];
for (NSDictionary *annoDict in array) { for (NSDictionary *annoDict in array) {
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getAnnounceListWithCompletion:^(id response, NSError *error) { [httpClient getAnnounceListWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
NSDictionary *dict = response[@"data"]; NSDictionary *dict = response[@"data"];
NSArray *array = dict[@"records"]; NSArray *array = dict[@"records"];
NSMutableArray *annoArray = [NSMutableArray array]; NSMutableArray *annoArray = [NSMutableArray array];
......
...@@ -314,7 +314,7 @@ ...@@ -314,7 +314,7 @@
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http1 = [[HttpClient alloc] initWithUrl:url]; HttpClient *http1 = [[HttpClient alloc] initWithUrl:url];
[http1 submitPicturePraiseWithCompletion:^(id response, NSError *error) { [http1 submitPicturePraiseWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }
}]; }];
......
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getLikePicturePraiseWithCompletion:^(id response, NSError *error) { [httpClient getLikePicturePraiseWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue]; int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal]; [sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else { } else {
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient cancelLikePicturePraiseWithCompletion:^(id response, NSError *error) { [httpClient cancelLikePicturePraiseWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue]; int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal]; [sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal];
} else { } else {
......
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
- (void)requestGroupTitle - (void)requestGroupTitle
{ {
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionGroupURL]]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionGroupURL]];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient getQuestionGroupWithCompletion:^(id response, NSError *error) { [httpClient getQuestionGroupWithCompletion:^(id response, NSError *error) {
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
...@@ -125,6 +126,7 @@ ...@@ -125,6 +126,7 @@
NSString *nameStr = [NSString stringWithFormat:@"%@", nameArray[0]]; NSString *nameStr = [NSString stringWithFormat:@"%@", nameArray[0]];
[self requestCategoryWithGroupUuid:[dict objectForKey:nameStr]]; [self requestCategoryWithGroupUuid:[dict objectForKey:nameStr]];
} }
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self.tableView reloadData]; [self.tableView reloadData];
}]; }];
...@@ -135,19 +137,19 @@ ...@@ -135,19 +137,19 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid]; NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http = [[HttpClient alloc] initWithUrl:url]; HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getQuestionCategoryWithCompletion:^(id response, NSError *error) { [http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { NSDictionary *dictData = response[@"data"];
NSDictionary *dictData = response[@"data"]; NSArray *array = dictData[@"records"];
NSArray *array = dictData[@"records"]; NSMutableArray *categoryArray = [NSMutableArray array];
NSMutableArray *categoryArray = [NSMutableArray array]; for (NSDictionary *dict in array) {
for (NSDictionary *dict in array) { NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]];
NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]]; [categoryArray addObject:category];
[categoryArray addObject:category];
}
_questionArray = categoryArray;
_isLoad = YES;
[self.tableView reloadData];
} }
_questionArray = categoryArray;
_isLoad = YES;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self.tableView reloadData];
}]; }];
} }
...@@ -367,7 +369,8 @@ ...@@ -367,7 +369,8 @@
HttpClient *client = [[HttpClient alloc] initWithUrl:url]; HttpClient *client = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) { [client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
alert.tag = 90393; alert.tag = 90393;
[alert show]; [alert show];
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) { [httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue]; int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal]; [sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else { } else {
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) { [httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue]; int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal]; [sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal];
} else { } else {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import "CategoryTableView.h" #import "CategoryTableView.h"
#import "HttpClient.h" #import "HttpClient.h"
#import <MBProgressHUD.h>
@interface CategoryTableView ()<UITableViewDelegate, UITableViewDataSource> @interface CategoryTableView ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) NSMutableArray *titleArray; @property (nonatomic, strong) NSMutableArray *titleArray;
...@@ -68,8 +69,9 @@ ...@@ -68,8 +69,9 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid]; NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http = [[HttpClient alloc] initWithUrl:url]; HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self animated:YES];
[http getQuestionCategoryWithCompletion:^(id response, NSError *error) { [http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
NSDictionary *dictData = response[@"data"]; NSDictionary *dictData = response[@"data"];
NSArray *array = dictData[@"records"]; NSArray *array = dictData[@"records"];
NSMutableArray *groupArray = [NSMutableArray array]; NSMutableArray *groupArray = [NSMutableArray array];
...@@ -83,6 +85,8 @@ ...@@ -83,6 +85,8 @@
} }
_titleArray = categoryArray; _titleArray = categoryArray;
_categoryArray = categoryArray; _categoryArray = categoryArray;
[MBProgressHUD hideAllHUDsForView:self animated:YES];
[self reloadData]; [self reloadData];
} }
}]; }];
......
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
}; };
[httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) { [httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) {
if (response[@"success"]) { if ([response[@"success"] boolValue]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"检查点上报成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"检查点上报成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.delegate = self; alert.delegate = self;
alert.tag = 39429234; alert.tag = 39429234;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment