Commit e09ea85b authored by admin's avatar admin

修复response[@"succeed"]

parent ea82248d
......@@ -10,13 +10,13 @@
#define Url_h
// 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.212:7580/"
// #define kRedStarURL @"http://219.235.234.212:7580/"
// 检查更新
#define kCheckUpdateURL @"redstar-server/rest/ipapk?type=ipa"
......
......@@ -78,7 +78,7 @@
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getAnnounceListWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
NSDictionary *dict = response[@"data"];
NSArray *array = dict[@"records"];
for (NSDictionary *annoDict in array) {
......@@ -151,7 +151,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getAnnounceListWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
NSDictionary *dict = response[@"data"];
NSArray *array = dict[@"records"];
NSMutableArray *annoArray = [NSMutableArray array];
......
......@@ -314,7 +314,7 @@
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http1 = [[HttpClient alloc] initWithUrl:url];
[http1 submitPicturePraiseWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
......
......@@ -226,7 +226,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient getLikePicturePraiseWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else {
......@@ -242,7 +242,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient cancelLikePicturePraiseWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal];
} else {
......
......@@ -106,6 +106,7 @@
- (void)requestGroupTitle
{
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionGroupURL]];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient getQuestionGroupWithCompletion:^(id response, NSError *error) {
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -125,6 +126,7 @@
NSString *nameStr = [NSString stringWithFormat:@"%@", nameArray[0]];
[self requestCategoryWithGroupUuid:[dict objectForKey:nameStr]];
}
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self.tableView reloadData];
}];
......@@ -135,19 +137,19 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
NSDictionary *dictData = response[@"data"];
NSArray *array = dictData[@"records"];
NSMutableArray *categoryArray = [NSMutableArray array];
for (NSDictionary *dict in array) {
NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]];
[categoryArray addObject:category];
}
_questionArray = categoryArray;
_isLoad = YES;
[self.tableView reloadData];
NSDictionary *dictData = response[@"data"];
NSArray *array = dictData[@"records"];
NSMutableArray *categoryArray = [NSMutableArray array];
for (NSDictionary *dict in array) {
NSString *category = [NSString stringWithFormat:@"%@", dict[@"name"]];
[categoryArray addObject:category];
}
_questionArray = categoryArray;
_isLoad = YES;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self.tableView reloadData];
}];
}
......@@ -367,7 +369,8 @@
HttpClient *client = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[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];
alert.tag = 90393;
[alert show];
......
......@@ -242,7 +242,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else {
......@@ -257,7 +257,7 @@
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount - 1] forState:UIControlStateNormal];
} else {
......
......@@ -8,6 +8,7 @@
#import "CategoryTableView.h"
#import "HttpClient.h"
#import <MBProgressHUD.h>
@interface CategoryTableView ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) NSMutableArray *titleArray;
......@@ -68,8 +69,9 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@",kRedStarURL, kQuestionCategoryURL, groupUuid];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
[MBProgressHUD showHUDAddedTo:self animated:YES];
[http getQuestionCategoryWithCompletion:^(id response, NSError *error) {
if (response[@"success"]) {
if ([response[@"success"] boolValue]) {
NSDictionary *dictData = response[@"data"];
NSArray *array = dictData[@"records"];
NSMutableArray *groupArray = [NSMutableArray array];
......@@ -83,6 +85,8 @@
}
_titleArray = categoryArray;
_categoryArray = categoryArray;
[MBProgressHUD hideAllHUDsForView:self animated:YES];
[self reloadData];
}
}];
......
......@@ -320,7 +320,7 @@
};
[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];
alert.delegate = self;
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