|
@@ -24,6 +24,9 @@
|
|
// 上传位置全路径
|
|
// 上传位置全路径
|
|
@property (nonatomic, strong) NSString *uploadBucket;
|
|
@property (nonatomic, strong) NSString *uploadBucket;
|
|
|
|
|
|
|
|
+// 访问位置全路径
|
|
|
|
+@property (nonatomic, strong) NSString *receiveBucket;
|
|
|
|
+
|
|
// bucket
|
|
// bucket
|
|
@property (nonatomic, strong) NSString *bucketName;
|
|
@property (nonatomic, strong) NSString *bucketName;
|
|
|
|
|
|
@@ -44,6 +47,7 @@
|
|
- (void)configCilentBucket {
|
|
- (void)configCilentBucket {
|
|
self.bucketName = @"daya";
|
|
self.bucketName = @"daya";
|
|
self.uploadBucket = @"ks3-cn-beijing.ksyuncs.com/daya";
|
|
self.uploadBucket = @"ks3-cn-beijing.ksyuncs.com/daya";
|
|
|
|
+ self.receiveBucket = [NSString stringWithFormat:@"daya.ks3-cn-beijing.ksyuncs.com"];
|
|
[[KS3Client initialize] setBucketDomain:self.uploadBucket];
|
|
[[KS3Client initialize] setBucketDomain:self.uploadBucket];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -53,6 +57,7 @@
|
|
}
|
|
}
|
|
self.bucketName = bucketName;
|
|
self.bucketName = bucketName;
|
|
self.uploadBucket = [NSString stringWithFormat:@"ks3-cn-beijing.ksyuncs.com/%@",bucketName];
|
|
self.uploadBucket = [NSString stringWithFormat:@"ks3-cn-beijing.ksyuncs.com/%@",bucketName];
|
|
|
|
+ self.receiveBucket = [NSString stringWithFormat:@"%@.ks3-cn-beijing.ksyuncs.com",bucketName];
|
|
[[KS3Client initialize] setBucketDomain:self.uploadBucket];
|
|
[[KS3Client initialize] setBucketDomain:self.uploadBucket];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -84,7 +89,7 @@
|
|
if (response.error == nil) {
|
|
if (response.error == nil) {
|
|
if (self.successCallback) {
|
|
if (self.successCallback) {
|
|
NSMutableArray *fileUrlArray = [NSMutableArray array];
|
|
NSMutableArray *fileUrlArray = [NSMutableArray array];
|
|
- [fileUrlArray addObject:[NSString stringWithFormat:@"https://%@/%@",self.uploadBucket,uploadFileName]];
|
|
|
|
|
|
+ [fileUrlArray addObject:[NSString stringWithFormat:@"https://%@/%@",self.receiveBucket,uploadFileName]];
|
|
self.successCallback(fileUrlArray);
|
|
self.successCallback(fileUrlArray);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -156,7 +161,7 @@
|
|
KS3PutObjectResponse *response = [[KS3Client initialize] putObject:putObjRequest];
|
|
KS3PutObjectResponse *response = [[KS3Client initialize] putObject:putObjRequest];
|
|
if (response.httpStatusCode == 200) {
|
|
if (response.httpStatusCode == 200) {
|
|
if (response.error == nil) {
|
|
if (response.error == nil) {
|
|
- [responses addObject:[NSString stringWithFormat:@"https://%@/%@",self.uploadBucket,uploadFileName]];
|
|
|
|
|
|
+ [responses addObject:[NSString stringWithFormat:@"https://%@/%@",self.receiveBucket,uploadFileName]];
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
NSString *desc = [NSString stringWithFormat:@"第%d次上传文件失败",i];
|
|
NSString *desc = [NSString stringWithFormat:@"第%d次上传文件失败",i];
|
|
@@ -210,7 +215,7 @@
|
|
}
|
|
}
|
|
NSString *uploadFileName = [NSString stringWithFormat:@"%@-%@%@%@",UserDefault(UIDKey),[NSDate getCurrentTimestamp], fileName,fileSuffix];
|
|
NSString *uploadFileName = [NSString stringWithFormat:@"%@-%@%@%@",UserDefault(UIDKey),[NSDate getCurrentTimestamp], fileName,fileSuffix];
|
|
NSString *keyValue = uploadFileName;
|
|
NSString *keyValue = uploadFileName;
|
|
- self.videoLinkUrl = [NSString stringWithFormat:@"https://%@/%@",self.uploadBucket,uploadFileName];
|
|
|
|
|
|
+ self.videoLinkUrl = [NSString stringWithFormat:@"https://%@/%@",self.receiveBucket,uploadFileName];
|
|
[KSNetworkingManager getUploadSignRequest:KS_POST fileName:uploadFileName keyName:keyValue bucketName:self.bucketName success:^(NSDictionary * _Nonnull dic) {
|
|
[KSNetworkingManager getUploadSignRequest:KS_POST fileName:uploadFileName keyName:keyValue bucketName:self.bucketName success:^(NSDictionary * _Nonnull dic) {
|
|
if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
|
|
KS3AccessControlList *acl = [[KS3AccessControlList alloc] init];
|
|
KS3AccessControlList *acl = [[KS3AccessControlList alloc] init];
|
|
@@ -224,7 +229,7 @@
|
|
self->_fileSize = putObjRequest.data.length;
|
|
self->_fileSize = putObjRequest.data.length;
|
|
putObjRequest.delegate = self;
|
|
putObjRequest.delegate = self;
|
|
[putObjRequest setCompleteRequest];
|
|
[putObjRequest setCompleteRequest];
|
|
- self.videoLinkUrl = [NSString stringWithFormat:@"https://%@/%@",self.uploadBucket,uploadFileName];
|
|
|
|
|
|
+ self.videoLinkUrl = [NSString stringWithFormat:@"https://%@/%@",self.receiveBucket,uploadFileName];
|
|
KS3PutObjectResponse *response = [[KS3Client initialize] putObject:putObjRequest];
|
|
KS3PutObjectResponse *response = [[KS3Client initialize] putObject:putObjRequest];
|
|
if (putObjRequest.delegate == nil) {
|
|
if (putObjRequest.delegate == nil) {
|
|
NSLog(@"%@",[[NSString alloc] initWithData:response.body encoding:NSUTF8StringEncoding]);
|
|
NSLog(@"%@",[[NSString alloc] initWithData:response.body encoding:NSUTF8StringEncoding]);
|
|
@@ -274,7 +279,7 @@
|
|
if (response.error == nil) {
|
|
if (response.error == nil) {
|
|
if (self.successCallback) {
|
|
if (self.successCallback) {
|
|
NSMutableArray *fileUrlArray = [NSMutableArray array];
|
|
NSMutableArray *fileUrlArray = [NSMutableArray array];
|
|
- [fileUrlArray addObject:[NSString stringWithFormat:@"https://%@/%@",self.uploadBucket,uploadFileName]];
|
|
|
|
|
|
+ [fileUrlArray addObject:[NSString stringWithFormat:@"https://%@/%@",self.receiveBucket,uploadFileName]];
|
|
self.successCallback(fileUrlArray);
|
|
self.successCallback(fileUrlArray);
|
|
}
|
|
}
|
|
}
|
|
}
|