Commit 5f621a7e3be5b1babcb123ae072ba58be9b1a204
1 parent
a284f37b
no message
Showing
1 changed file
with
52 additions
and
24 deletions
CNLiveUserAgreementManager/Classes/CNLiveAgreementWebController.m
| ... | ... | @@ -261,6 +261,7 @@ |
| 261 | 261 | _webView.navigationDelegate = self; |
| 262 | 262 | _webView.contentMode = UIViewContentModeScaleAspectFit; |
| 263 | 263 | _webView.scrollView.showsHorizontalScrollIndicator = NO; |
| 264 | + _webView.scrollView.showsVerticalScrollIndicator = NO; | |
| 264 | 265 | _webView.allowsBackForwardNavigationGestures = YES; |
| 265 | 266 | _webView.allowsLinkPreview = NO; |
| 266 | 267 | [self.view addSubview:self.webView]; |
| ... | ... | @@ -499,35 +500,39 @@ |
| 499 | 500 | |
| 500 | 501 | }]; |
| 501 | 502 | |
| 502 | - NSMutableDictionary *picDict = [NSMutableDictionary dictionaryWithCapacity:_photos.count]; | |
| 503 | - NSMutableArray *keyArr = [NSMutableArray arrayWithCapacity:_photos.count]; | |
| 504 | -// self.picArr = [NSMutableArray arrayWithCapacity:_photos.count]; | |
| 503 | + __block | |
| 504 | + __block NSMutableArray *keyArr = [NSMutableArray array]; | |
| 505 | + __block NSMutableArray *picArr = [NSMutableArray array]; | |
| 506 | + | |
| 505 | 507 | for (int i = 0; i < _photos.count; i++) { |
| 506 | 508 | @autoreleasepool { |
| 507 | 509 | UIImage *image = _photos[i]; |
| 508 | - __block NSData *imageData1 = UIImageJPEGRepresentation(image, 1); | |
| 509 | -// NSString *timeTampStr = [CNLiveTimeTools get13tsRandTimeStr]; | |
| 510 | -// NSString *qiniuFileName = [NSString stringWithFormat:@"%@/%@.jpg",[self getImageBuketkeyFromServerWithExt], timeTampStr]; | |
| 510 | + __block NSData *imageData = UIImageJPEGRepresentation(image, 1); | |
| 511 | + NSString *timeTampStr = [self get13tsRandTimeStr]; | |
| 512 | + NSString *qiniuFileName = [NSString stringWithFormat:@"%@/%@.jpg",[self getImageBuketkeyFromServerWithExt], timeTampStr]; | |
| 511 | 513 | QNUploadManager *uploadManager = [QNUploadManager sharedInstanceWithConfiguration:nil]; |
| 512 | - [uploadManager putData:imageData1 key:@"qiniuFileName" token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) { | |
| 514 | + [uploadManager putData:imageData key:qiniuFileName token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) { | |
| 513 | 515 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 514 | 516 | if(!strongSelf) return ; |
| 515 | 517 | if (info.ok) { |
| 516 | - NSString *imageUrl = [NSString stringWithFormat:@"%@%@",API_PhotoUrl,key]; | |
| 517 | - [picDict setObject:imageUrl ? imageUrl: @"" forKey:@"imageUrl"]; | |
| 518 | - [picDict setObject:[NSString stringWithFormat:@"%.0f",image.size.width] forKey:@"imageWidth"]; | |
| 519 | - [picDict setObject:[NSString stringWithFormat:@"%.0f",image.size.height] forKey:@"imageHeight"]; | |
| 520 | 518 | [keyArr addObject:key]; |
| 521 | - NSMutableDictionary *dict = [[NSMutableDictionary alloc]initWithDictionary:picDict]; | |
| 522 | -// [self.picArr addObject:dict]; | |
| 519 | + | |
| 520 | + NSString *imageUrl = [NSString stringWithFormat:@"%@%@",API_PhotoUrl,key]; | |
| 521 | + NSMutableDictionary *picDic = [NSMutableDictionary dictionary]; | |
| 522 | + [picDic setObject:imageUrl ? imageUrl : @"" forKey:@"imageUrl"]; | |
| 523 | + [picDic setObject:[NSString stringWithFormat:@"%.0f",image.size.width] forKey:@"imageWidth"]; | |
| 524 | + [picDic setObject:[NSString stringWithFormat:@"%.0f",image.size.height] forKey:@"imageHeight"]; | |
| 525 | + [picArr addObject:picDic]; | |
| 523 | 526 | |
| 524 | 527 | if (keyArr.count == strongSelf.photos.count) { |
| 525 | -// id data = @{ @"images": strongSelf.picArr.copy }; | |
| 526 | -// [strongSelf.photos removeAllObjects]; | |
| 527 | -// // 帮助与反馈->产品建议App->h5图片urls | |
| 528 | -// [strongSelf.bridge callHandler:@"wjjSubmitSuccess" data:data responseCallback:^(id responseData) { | |
| 529 | -// NSLog(@"ObjC received response: %@", responseData); | |
| 530 | -// }]; | |
| 528 | + id data = @{ @"images": picArr.copy }; | |
| 529 | + [strongSelf.photos removeAllObjects]; | |
| 530 | + // 帮助与反馈->产品建议App->h5图片urls | |
| 531 | + [strongSelf.bridge callHandler:@"wjjSubmitSuccess" data:data responseCallback:^(id responseData) { | |
| 532 | + if(TestEnvironment){ | |
| 533 | + NSLog(@"ObjC received response: %@", responseData); | |
| 534 | + } | |
| 535 | + }]; | |
| 531 | 536 | } |
| 532 | 537 | |
| 533 | 538 | } else if (info.broken) { |
| ... | ... | @@ -543,15 +548,38 @@ |
| 543 | 548 | } option:nil]; |
| 544 | 549 | } |
| 545 | 550 | } |
| 546 | - | |
| 547 | 551 | } |
| 548 | 552 | |
| 549 | 553 | //获取当前时间戳 |
| 550 | 554 | - (NSString *)currentTimestamp{ |
| 551 | - NSDate * date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间 | |
| 552 | - NSTimeInterval time = [date timeIntervalSince1970];// *1000 是精确到毫秒,不乘就是精确到秒 | |
| 553 | - NSString *timeString = [NSString stringWithFormat:@"%.0f", time]; | |
| 554 | - return timeString; | |
| 555 | + NSDate *datenow = [NSDate date]; | |
| 556 | + NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]]; | |
| 557 | + return timeSp; | |
| 558 | + | |
| 559 | +} | |
| 560 | + | |
| 561 | +- (NSString *)get13tsRandTimeStr { | |
| 562 | + NSString *str1 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 563 | + NSString *str2 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 564 | + NSString *str3 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 565 | + NSString *str4 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 566 | + NSString *str5 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 567 | + NSString *str6 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 568 | + NSString *str7 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 569 | + NSString *str8 = [NSString stringWithFormat:@"%d",arc4random() % 10]; | |
| 570 | + | |
| 571 | + NSString *randTimeStr = [NSString stringWithFormat:@"%@%@%@%@%@%@%@%@%@",[self currentTimestamp],str1,str2,str3,str4,str5,str6,str7,str8]; | |
| 572 | + return randTimeStr; | |
| 573 | + | |
| 574 | +} | |
| 575 | + | |
| 576 | +- (NSString *)getImageBuketkeyFromServerWithExt{ | |
| 577 | +// NSString *spid = [CNLiveBusinessTools getSpid]; | |
| 578 | +// NSString *imgBucketKey = [NSString stringWithFormat:@"%@/img", spid]; | |
| 579 | +// NSString *yearTime = [CNLiveTimeTools getyyMMdd]; | |
| 580 | +// NSString *bucketKey = [NSString stringWithFormat:@"%@/%@",imgBucketKey,yearTime]; | |
| 581 | +// return bucketKey; | |
| 582 | + return @""; | |
| 555 | 583 | |
| 556 | 584 | } |
| 557 | 585 | ... | ... |