This commit is contained in:
2014-09-24 00:02:13 +08:00
parent 24f9ede81c
commit c5b54b2326
4 changed files with 26 additions and 41 deletions
@@ -31,16 +31,26 @@
}else{
dic = [[NSMutableDictionary alloc] init];
}
NSString* sign = @"";
NSDate* timeDate = [NSDate dateWithTimeIntervalSinceNow:0];
NSTimeInterval timeInterval =[timeDate timeIntervalSince1970]*1000;
NSString *timeString = [NSString stringWithFormat:@"%f", timeInterval];//转为字符型
[dic setObject:timeString forKey:@"timeStamp"];
if ([ManagerUser shareInstance].token.length > 0) {
[dic setObject:[ManagerUser shareInstance].token forKey:@"token"];
}
// NSString *timeString = [NSString stringWithFormat:@"%f", timeInterval];//转为字符型
NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
[dateformatter setDateFormat:@"yyyy-MMddHHmm:ss"];
NSString * timeString=[dateformatter stringFromDate:timeDate];
[dic setObject:[NSString stringWithFormat:@"%f", timeInterval] forKey:@"timeStamp"];
if ([ManagerUser shareInstance].userId.length > 0) {
[dic setObject:[ManagerUser shareInstance].userId forKey:@"userid"];
}
if ([ManagerUser shareInstance].token.length > 0) {
[dic setObject:[ManagerUser shareInstance].token forKey:@"token"];
sign = [sign stringByAppendingString:[ManagerUser shareInstance].token];
}
sign = [sign stringByAppendingString:timeString];
sign = [sign stringByAppendingString:@"qHdKC5yNgKwdi1BFa5EKOw29fwYeetV78EcSN04H93jBYvoLkP631rFcSa3OT3Np"];
[dic setObject:[ManagerUtil md5:sign] forKey:@"sign"];
NSError *parseError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
NSString* tempStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
@@ -55,22 +55,6 @@
#pragma mark MJRefreshDelegate
- (void)headerRereshing
{
// DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
// [daiDaiTongApi getFundDetailWithFundId:_productId withCompletionBlock:^(id jsonRes) {
// if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
// self.navigationItem.title = [jsonRes objectForKey:@"fundName"];
// [_wydInfoHedaView setInfoWithDic:jsonRes];
// _infoDic = [NSDictionary dictionaryWithDictionary:jsonRes];
// [self.tableView reloadData];
// }else{
// [MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
// }
//
// [self.tableView headerEndRefreshing];
// } failedBlock:^(NSError *error) {
// [self.tableView headerEndRefreshing];
// [MBProgressHUD errorHudWithView:self.view label:@"网络出错" hidesAfter:0.5];
// }];
DaiDaiTongTestApi* daiDaiTongTestApi = [DaiDaiTongTestApi shareInstance];
[daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:_productId,@"proId", nil] withApiType:@"proDetail" completionBlock:^(id jsonRes) {
@@ -88,7 +72,7 @@
_wydInfoHedaView.hidden = NO;
}else{
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5];
[MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"resultMsg"] hidesAfter:0.5];
_wydInfoHedaView.hidden = YES;
}
[self.tableView headerEndRefreshing];
@@ -149,7 +133,7 @@
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString* cellIDentifier = [NSString stringWithFormat:@"CellIDentifier%ld-%ld",indexPath.section,indexPath.row];
NSString* cellIDentifier = [NSString stringWithFormat:@"CellIDentifier%ld-%d",indexPath.section,indexPath.row];
DTAttributedTextCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIDentifier];
if (!cell) {
cell = [[DTAttributedTextCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIDentifier];
@@ -64,25 +64,15 @@
#pragma mark MJRefreshDelegate
- (void)headerRereshing
{
// DaiDaiTongApi* daiDaiTongApi = [DaiDaiTongApi shareInstance];
// [daiDaiTongApi getAccountInfoWithcompletionBlock:^(id jsonRes) {
//
// if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) {
// _myInfoDic = [NSDictionary dictionaryWithDictionary:jsonRes];
// }
// [_tableView reloadData];
// [_tableView headerEndRefreshing];
// } failedBlock:^(NSError *error) {
// [MBProgressHUD errorHudWithView:self.view label:Net_Error_Str hidesAfter:0.5];
// [_tableView reloadData];
// [_tableView headerEndRefreshing];
// }];
DaiDaiTongTestApi* daiDaiTongTestApi = [DaiDaiTongTestApi shareInstance];
[daiDaiTongTestApi getApiWithParam:nil withApiType:@"userMsg" completionBlock:^(id jsonRes) {
if ([[jsonRes objectForKey:@"resultflag"] integerValue] != 0) {
[MBProgressHUD errorHudWithView:self.view label:[jsonRes objectForKey:@"resultMsg"] hidesAfter:0.5];
[ManagerUtil presentLoginView];
[MBProgressHUD errorHudWithView:self.view label:[jsonRes objectForKey:@"resultMsg"] hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[ManagerUtil presentLoginView];
});
}else{
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
_myInfoDic = [NSDictionary dictionaryWithDictionary:jsonRes];
@@ -216,16 +206,16 @@
switch (indexPath.section) {
case 0:
{
cell.textLabel.text = [[_myInfoDic objectForKey:@"userMsg"] objectForKey:@"userName"];
cell.textLabel.text = [[_myInfoDic objectForKey:@"userMsg"] objectForKey:@"realName"];
cell.imageView.image = [UIImage imageNamed:@"icon_person_take_image"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// cell.detailTextLabel.text = [[_myInfoDic objectForKey:@"info"] objectForKey:@"cell"];
cell.detailTextLabel.text = [[_myInfoDic objectForKey:@"userMsg"] objectForKey:@"userName"];
cell.selectedBackgroundView.backgroundColor = Touch_BackGroudColor;
}
break;
case 1:
{
NSDate * senddate=[NSDate date];
NSDate * senddate= [NSDate dateWithTimeIntervalSinceNow:-(24 * 60 * 60)];
NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
[dateformatter setDateFormat:@"MM月dd日"];
@@ -233,6 +223,7 @@
NSString * locationString=[dateformatter stringFromDate:senddate];
_timeLabel.text = [NSString stringWithFormat:@"%@收益(元)",locationString];
_profitLabel.text = [NSString stringWithFormat:@"%.2f",_todayProfit];
NSLog(@"%f",_todayProfit);
}
break;
case 2: