Commit 48f428d0ed6cc1ce6fb0419aa4aaf486c71a9b90
1 parent
a990a2f1
上传视频和图片 部分代码
Showing
10 changed files
with
148 additions
and
116 deletions
metaCode.xcodeproj/project.pbxproj
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | 191733002B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191732FF2B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift */; }; | 28 | 191733002B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191732FF2B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift */; }; |
| 29 | 191733022B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733012B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift */; }; | 29 | 191733022B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733012B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift */; }; |
| 30 | 191733042B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733032B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift */; }; | 30 | 191733042B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733032B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift */; }; |
| 31 | + 1917330A2B10864F007BCC04 /* Array+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733092B10864F007BCC04 /* Array+CNLiveExtensions.swift */; }; | ||
| 31 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; | 32 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; |
| 32 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; | 33 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; |
| 33 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; | 34 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; |
| @@ -219,6 +220,7 @@ | @@ -219,6 +220,7 @@ | ||
| 219 | 191732FF2B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSelectUploadImageModel.swift; sourceTree = "<group>"; }; | 220 | 191732FF2B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSelectUploadImageModel.swift; sourceTree = "<group>"; }; |
| 220 | 191733012B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSelUplSingleImageView.swift; sourceTree = "<group>"; }; | 221 | 191733012B0C4EAB007BCC04 /* CNLiveSelUplSingleImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSelUplSingleImageView.swift; sourceTree = "<group>"; }; |
| 221 | 191733032B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDictionary+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | 222 | 191733032B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDictionary+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| 223 | + 191733092B10864F007BCC04 /* Array+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | ||
| 222 | 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; | 224 | 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; |
| 223 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; | 225 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; |
| 224 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; | 226 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; |
| @@ -540,6 +542,7 @@ | @@ -540,6 +542,7 @@ | ||
| 540 | 19CC4D552ADD19C200308E2A /* String+Extension.swift */, | 542 | 19CC4D552ADD19C200308E2A /* String+Extension.swift */, |
| 541 | 191732E62B0615C1007BCC04 /* UIScrollView+CNLiveExtensions.swift */, | 543 | 191732E62B0615C1007BCC04 /* UIScrollView+CNLiveExtensions.swift */, |
| 542 | 191733032B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift */, | 544 | 191733032B0F216E007BCC04 /* NSDictionary+CNLiveExtensions.swift */, |
| 545 | + 191733092B10864F007BCC04 /* Array+CNLiveExtensions.swift */, | ||
| 543 | ); | 546 | ); |
| 544 | path = Extensions; | 547 | path = Extensions; |
| 545 | sourceTree = "<group>"; | 548 | sourceTree = "<group>"; |
| @@ -1365,6 +1368,7 @@ | @@ -1365,6 +1368,7 @@ | ||
| 1365 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, | 1368 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, |
| 1366 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, | 1369 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
| 1367 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, | 1370 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, |
| 1371 | + 1917330A2B10864F007BCC04 /* Array+CNLiveExtensions.swift in Sources */, | ||
| 1368 | 191732FB2B0AF34A007BCC04 /* CNLiveShopGoodsDetailsModel.swift in Sources */, | 1372 | 191732FB2B0AF34A007BCC04 /* CNLiveShopGoodsDetailsModel.swift in Sources */, |
| 1369 | 794FF1052B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift in Sources */, | 1373 | 794FF1052B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift in Sources */, |
| 1370 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, | 1374 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, |
metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
| @@ -11,6 +11,7 @@ import CNLiveRequestBastKit | @@ -11,6 +11,7 @@ import CNLiveRequestBastKit | ||
| 11 | 11 | ||
| 12 | typealias ProgressBlcok = (_ key: String,_ percent: CGFloat) -> Void | 12 | typealias ProgressBlcok = (_ key: String,_ percent: CGFloat) -> Void |
| 13 | typealias SuccessBlock = (_ key: String,_ url: String) -> Void | 13 | typealias SuccessBlock = (_ key: String,_ url: String) -> Void |
| 14 | + | ||
| 14 | class UploadManager: NSObject { | 15 | class UploadManager: NSObject { |
| 15 | 16 | ||
| 16 | var uploadModels = NSMutableArray() | 17 | var uploadModels = NSMutableArray() |
| @@ -34,7 +35,7 @@ class UploadManager: NSObject { | @@ -34,7 +35,7 @@ class UploadManager: NSObject { | ||
| 34 | /// - imageData: 图片数据 | 35 | /// - imageData: 图片数据 |
| 35 | /// - progressBlock: 进度回调 | 36 | /// - progressBlock: 进度回调 |
| 36 | /// - successBlock: 成功回调 | 37 | /// - successBlock: 成功回调 |
| 37 | - static func uploadImage(imageData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) { | 38 | + static func uploadImage(imageData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) -> String { |
| 38 | let key = UploadManager.createImageFileName() | 39 | let key = UploadManager.createImageFileName() |
| 39 | UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock) | 40 | UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock) |
| 40 | } | 41 | } |
| @@ -44,12 +45,40 @@ class UploadManager: NSObject { | @@ -44,12 +45,40 @@ class UploadManager: NSObject { | ||
| 44 | /// - imageData: 视频数据 | 45 | /// - imageData: 视频数据 |
| 45 | /// - progressBlock: 进度回调 | 46 | /// - progressBlock: 进度回调 |
| 46 | /// - successBlock: 成功回调 | 47 | /// - successBlock: 成功回调 |
| 47 | - static func uploadVideo(videoData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) { | 48 | + static func uploadVideo(videoData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) -> String { |
| 48 | let key = UploadManager.createVideoFileName() | 49 | let key = UploadManager.createVideoFileName() |
| 49 | UploadManager.uploadData(madiaData: videoData, key: key, progress: progressBlock, success: successBlock) | 50 | UploadManager.uploadData(madiaData: videoData, key: key, progress: progressBlock, success: successBlock) |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | - | 53 | + // MARK: - 取消上传 |
| 54 | + func cancelUploadKey(key:String){ | ||
| 55 | + for (_,obj) in self.uploadModels.enumerated() { | ||
| 56 | + let model = obj as! QiNiuUploadModel | ||
| 57 | + if model.key == key{ | ||
| 58 | + model.isCancel = true | ||
| 59 | + break | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + // MARK: - 删除云中图片 | ||
| 64 | + func requestQiNiuDeleteImageUrl(imageUrl:String,resultBlock:downSlideResultBlock){ | ||
| 65 | + | ||
| 66 | + let param = NSMutableDictionary() | ||
| 67 | + param.setValue(imageUrl, forKey: "img") | ||
| 68 | + showLoading(message: "处理中...") | ||
| 69 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 70 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 71 | + CNLiveNetworking.setupDSRequest(true) | ||
| 72 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/Api/v1/delQiniuImg", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 73 | + hiddenLoading() | ||
| 74 | + if (error == nil) { | ||
| 75 | + resultBlock(result as Any,.success) | ||
| 76 | + }else{ | ||
| 77 | + resultBlock(NSNull(),.failed) | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + } | ||
| 53 | 82 | ||
| 54 | /// 上传到七牛 | 83 | /// 上传到七牛 |
| 55 | /// - Parameters: | 84 | /// - Parameters: |
metaCode/Classes/Extensions/Array+CNLiveExtensions.swift
0 → 100644
| 1 | +// | ||
| 2 | +// Array+CNLiveExtensions.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2023/11/24. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +extension Array where Element: Equatable { | ||
| 11 | + | ||
| 12 | + // Remove first collection element that is equal to the given `object`: | ||
| 13 | + mutating func remove(_ object: Element) { | ||
| 14 | + if let index = firstIndex(of: object) { | ||
| 15 | + remove(at: index) | ||
| 16 | + } | ||
| 17 | + } | ||
| 18 | +} |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveCreateShopClassifyViewController.swift
| @@ -76,10 +76,6 @@ class CNLiveCreateShopClassifyViewController:CNLiveBaseViewController, UITableVi | @@ -76,10 +76,6 @@ class CNLiveCreateShopClassifyViewController:CNLiveBaseViewController, UITableVi | ||
| 76 | self.isEdite = isEdite | 76 | self.isEdite = isEdite |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | - required init?(coder: NSCoder) { | ||
| 80 | - fatalError("init(coder:) has not been implemented") | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | // MARK: - 初始化UI | 79 | // MARK: - 初始化UI |
| 84 | func initUI(){ | 80 | func initUI(){ |
| 85 | self.view.addSubview(self.tableView) | 81 | self.view.addSubview(self.tableView) |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveGoodsCategoryController.swift
| @@ -470,7 +470,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo | @@ -470,7 +470,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo | ||
| 470 | 470 | ||
| 471 | ///创建店铺分类 | 471 | ///创建店铺分类 |
| 472 | @objc func createBtnClick(){ | 472 | @objc func createBtnClick(){ |
| 473 | - let vc = CNLiveCreateShopClassifyViewController() | 473 | + let vc = CNLiveCreateShopClassifyViewController() |
| 474 | vc.classifyType = .oneLevelClassify | 474 | vc.classifyType = .oneLevelClassify |
| 475 | vc.successCompleteBlock = { | 475 | vc.successCompleteBlock = { |
| 476 | self.postShopClassify() | 476 | self.postShopClassify() |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveAddGoodsSelectUploadImageView.swift
| @@ -174,9 +174,11 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -174,9 +174,11 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 174 | i -= 1 | 174 | i -= 1 |
| 175 | let model = self.uploadImageUrls[i] | 175 | let model = self.uploadImageUrls[i] |
| 176 | if model.isUploading == true{ | 176 | if model.isUploading == true{ |
| 177 | - [[DSQiNiuUploadManager sharedManager] cancelUploadKey:model.uploadKey]; | 177 | + UploadManager.shared.cancelUploadKey(key: model.uploadKey!) |
| 178 | }else{ | 178 | }else{ |
| 179 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:model.imageUrl complete:nil]; | 179 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: model.imageUrl!) { result, status in |
| 180 | + | ||
| 181 | + } | ||
| 180 | self.uploadImageUrls.remove(model) | 182 | self.uploadImageUrls.remove(model) |
| 181 | } | 183 | } |
| 182 | } | 184 | } |
| @@ -300,8 +302,8 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -300,8 +302,8 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 300 | 302 | ||
| 301 | @return 网络视频Url | 303 | @return 网络视频Url |
| 302 | */ | 304 | */ |
| 303 | - func getCurrentSelectLocalVideoUrl()->NSURL{ | ||
| 304 | - return self.uploadVideoModel?.localVideoUrl ?? NSURL() | 305 | + func getCurrentSelectLocalVideoUrl()->URL{ |
| 306 | + return (self.uploadVideoModel?.localVideoUrl)! | ||
| 305 | } | 307 | } |
| 306 | /** | 308 | /** |
| 307 | 获取当前选取的本地视频Url第一帧图片 | 309 | 获取当前选取的本地视频Url第一帧图片 |
| @@ -316,11 +318,15 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -316,11 +318,15 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 316 | */ | 318 | */ |
| 317 | func deleteReplaceImageUrlAfterSuccessUploadThings(){ | 319 | func deleteReplaceImageUrlAfterSuccessUploadThings(){ |
| 318 | for replaceImageModel in self.replaceImageUrls { | 320 | for replaceImageModel in self.replaceImageUrls { |
| 319 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:replaceImageModel.imageUrl complete:nil]; | 321 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: replaceImageModel.imageUrl!) { result, status in |
| 322 | + | ||
| 323 | + } | ||
| 320 | } | 324 | } |
| 321 | self.networkImageArr = self.getCurrentSelectImageUrls() | 325 | self.networkImageArr = self.getCurrentSelectImageUrls() |
| 322 | for replaceVideoModel in self.replaceVideoUrls { | 326 | for replaceVideoModel in self.replaceVideoUrls { |
| 323 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:replaceVideoModel.videoUrl complete:nil]; | 327 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: replaceVideoModel.videoUrl!) { result, status in |
| 328 | + | ||
| 329 | + } | ||
| 324 | } | 330 | } |
| 325 | self.networkVideoUrl = self.getCurrentSelectVideoUrl() | 331 | self.networkVideoUrl = self.getCurrentSelectVideoUrl() |
| 326 | } | 332 | } |
| @@ -336,15 +342,19 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -336,15 +342,19 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 336 | */ | 342 | */ |
| 337 | func deleteUploadImageUrl(){ | 343 | func deleteUploadImageUrl(){ |
| 338 | for uploadImageModel in self.uploadImageUrls { | 344 | for uploadImageModel in self.uploadImageUrls { |
| 339 | - if ((self.networkImageArr?.contains(uploadImageModel.imageUrl ?? "")) != nil){ | ||
| 340 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:uploadImageModel.imageUrl complete:nil]; | 345 | + if !self.networkImageArr.contains(uploadImageModel.imageUrl!){ |
| 346 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: uploadImageModel.imageUrl!) { result, status in | ||
| 347 | + | ||
| 348 | + } | ||
| 341 | }else if uploadImageModel.isUploading == true{ | 349 | }else if uploadImageModel.isUploading == true{ |
| 342 | - [[DSQiNiuUploadManager sharedManager] cancelUploadKey:uploadImageModel.uploadKey]; | 350 | + UploadManager.shared.cancelUploadKey(key: uploadImageModel.uploadKey!) |
| 343 | } | 351 | } |
| 344 | } | 352 | } |
| 345 | for replaceImageModel in self.replaceImageUrls{ | 353 | for replaceImageModel in self.replaceImageUrls{ |
| 346 | - if ((self.networkImageArr.contains(replaceImageModel.imageUrl ?? "")) != nil){ | ||
| 347 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:replaceImageModel.imageUrl complete:nil]; | 354 | + if !self.networkImageArr.contains(replaceImageModel.imageUrl!){ |
| 355 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: replaceImageModel.imageUrl!) { result, status in | ||
| 356 | + | ||
| 357 | + } | ||
| 348 | } | 358 | } |
| 349 | } | 359 | } |
| 350 | } | 360 | } |
| @@ -353,13 +363,17 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -353,13 +363,17 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 353 | */ | 363 | */ |
| 354 | func deleteUploadVideoUrl(){ | 364 | func deleteUploadVideoUrl(){ |
| 355 | if self.networkVideoUrl != self.uploadVideoModel?.videoUrl{ | 365 | if self.networkVideoUrl != self.uploadVideoModel?.videoUrl{ |
| 356 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:self.uploadVideoModel.videoUrl complete:nil]; | 366 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: (self.uploadVideoModel?.videoUrl)!) { result, status in |
| 367 | + | ||
| 368 | + } | ||
| 357 | }else if self.uploadVideoModel?.isUploading == true{ | 369 | }else if self.uploadVideoModel?.isUploading == true{ |
| 358 | - [[DSQiNiuUploadManager sharedManager] cancelUploadKey:self.uploadVideoModel.uploadKey]; | 370 | + UploadManager.shared.cancelUploadKey(key: self.uploadVideoModel!.uploadKey!) |
| 359 | } | 371 | } |
| 360 | for replaceVideoModel in self.replaceVideoUrls { | 372 | for replaceVideoModel in self.replaceVideoUrls { |
| 361 | if self.networkVideoUrl != replaceVideoModel.videoUrl{ | 373 | if self.networkVideoUrl != replaceVideoModel.videoUrl{ |
| 362 | - [[DSQiNiuUploadManager sharedManager] requestQiNiuDeleteImageUrl:replaceVideoModel.videoUrl complete:nil]; | 374 | + UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: replaceVideoModel .videoUrl!) { result, status in |
| 375 | + | ||
| 376 | + } | ||
| 363 | } | 377 | } |
| 364 | } | 378 | } |
| 365 | } | 379 | } |
| @@ -513,7 +527,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -513,7 +527,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 513 | } | 527 | } |
| 514 | for i in 0..<self.networkImageArr.count { | 528 | for i in 0..<self.networkImageArr.count { |
| 515 | var model = CNLiveSelectUploadImageModel() | 529 | var model = CNLiveSelectUploadImageModel() |
| 516 | - model.imageUrl = self.networkImageArr![i] | 530 | + model.imageUrl = self.networkImageArr[i] |
| 517 | 531 | ||
| 518 | var singleImageView = self.createSingleImageView() | 532 | var singleImageView = self.createSingleImageView() |
| 519 | if self.networkVideoUrl!.count > 0{ | 533 | if self.networkVideoUrl!.count > 0{ |
| @@ -642,7 +656,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -642,7 +656,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 642 | if model.imageUrl == singleImageView.model?.imageUrl{ | 656 | if model.imageUrl == singleImageView.model?.imageUrl{ |
| 643 | if singleImageView.model?.isVideo == true{ | 657 | if singleImageView.model?.isVideo == true{ |
| 644 | if singleImageView.model?.isUploading == true{ | 658 | if singleImageView.model?.isUploading == true{ |
| 645 | - [[DSQiNiuUploadManager sharedManager] cancelUploadKey:singleImageView.model.uploadKey]; | 659 | + UploadManager.shared.cancelUploadKey(key: singleImageView.model!.uploadKey!) |
| 646 | }else{ | 660 | }else{ |
| 647 | self.replaceVideoUrls.append(singleImageView.model!) | 661 | self.replaceVideoUrls.append(singleImageView.model!) |
| 648 | var videoModel = CNLiveSelectUploadImageModel() | 662 | var videoModel = CNLiveSelectUploadImageModel() |
| @@ -651,7 +665,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -651,7 +665,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 651 | } | 665 | } |
| 652 | }else{ | 666 | }else{ |
| 653 | if singleImageView.model?.isUploading == true{ | 667 | if singleImageView.model?.isUploading == true{ |
| 654 | - [[DSQiNiuUploadManager sharedManager] cancelUploadKey:singleImageView.model.uploadKey]; | 668 | + UploadManager.shared.cancelUploadKey(key: singleImageView.model!.uploadKey!) |
| 655 | }else{ | 669 | }else{ |
| 656 | let index = self.uploadImageUrls.firstIndex(of: singleImageView.model!)! | 670 | let index = self.uploadImageUrls.firstIndex(of: singleImageView.model!)! |
| 657 | self.uploadImageUrls.remove(at: index) | 671 | self.uploadImageUrls.remove(at: index) |
| @@ -668,6 +682,8 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -668,6 +682,8 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 668 | 682 | ||
| 669 | // MARK: - PickerControllerDelegate | 683 | // MARK: - PickerControllerDelegate |
| 670 | func pickerController(_ pickerController: HXPHPicker.PhotoPickerController, didFinishSelection result: HXPHPicker.PickerResult) { | 684 | func pickerController(_ pickerController: HXPHPicker.PhotoPickerController, didFinishSelection result: HXPHPicker.PickerResult) { |
| 685 | + | ||
| 686 | + | ||
| 671 | let photoAssets = result.photoAssets | 687 | let photoAssets = result.photoAssets |
| 672 | for asset in photoAssets{ | 688 | for asset in photoAssets{ |
| 673 | if asset.mediaType == .video | 689 | if asset.mediaType == .video |
| @@ -675,102 +691,71 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | @@ -675,102 +691,71 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat | ||
| 675 | let videoFileName = "\(asset.phAsset?.localIdentifier ?? "").mp4".replacingOccurrences(of: "-", with: "").replacingOccurrences(of: "/", with: "") | 691 | let videoFileName = "\(asset.phAsset?.localIdentifier ?? "").mp4".replacingOccurrences(of: "-", with: "").replacingOccurrences(of: "/", with: "") |
| 676 | let videoURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(videoFileName) | 692 | let videoURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(videoFileName) |
| 677 | 693 | ||
| 678 | - let videoData = NSData(contentsOf: videoURL) | 694 | + let videoData = NSData(contentsOf: videoURL) ?? NSData() |
| 679 | self.splitVideoFileUrlFps(splitFileUrl: videoURL, fps: 1) { isSucc,firstImage in | 695 | self.splitVideoFileUrlFps(splitFileUrl: videoURL, fps: 1) { isSucc,firstImage in |
| 680 | if isSucc{ | 696 | if isSucc{ |
| 681 | self.uploadVideoModel?.videoUrl = nil | 697 | self.uploadVideoModel?.videoUrl = nil |
| 682 | self.uploadVideoModel?.image = firstImage.first | 698 | self.uploadVideoModel?.image = firstImage.first |
| 683 | self.uploadVideoModel?.localVideoUrl = videoURL | 699 | self.uploadVideoModel?.localVideoUrl = videoURL |
| 684 | - self.uploadVideoModel.isUploading = true | 700 | + self.uploadVideoModel?.isUploading = true |
| 685 | 701 | ||
| 686 | - self.uploadVideoModel?.uploadKey = [[DSQiNiuUploadManager sharedManager] uploadVideoData:videoData uploadProgress:^(NSString * _Nonnull key, CGFloat percent) { | ||
| 687 | - weakSelf.uploadVideoModel.uploadingPercent = percent; | ||
| 688 | - [weakSelf replaceVideoModelInSubviews:self.uploadVideoModel target:firstImage]; | ||
| 689 | - } complete:^(NSString * _Nonnull key, DSQiNiuUploadResult result, NSString * _Nonnull videoUrl, NSString * _Nonnull errorMessage) { | ||
| 690 | - if (errorMessage) { | ||
| 691 | - DS_showMessage(errorMessage); | ||
| 692 | - DSSelectUploadImageModel * videoModel = [[DSSelectUploadImageModel alloc] init]; | ||
| 693 | - videoModel.isVideo = YES; | ||
| 694 | - weakSelf.uploadVideoModel = videoModel; | ||
| 695 | - }else { | ||
| 696 | - self.uploadVideoModel.videoUrl = videoUrl; | ||
| 697 | - self.uploadVideoModel.isUploading = NO; | ||
| 698 | - self.uploadVideoModel.uploadKey = nil; | ||
| 699 | - [weakSelf replaceVideoModelInSubviews:self.uploadVideoModel target:firstImage]; | ||
| 700 | - } | ||
| 701 | - | ||
| 702 | - weakSelf.uploadingCount = weakSelf.uploadingCount - 1; | ||
| 703 | - if (weakSelf.uploadingCount == 0) { | ||
| 704 | - if (weakSelf.endUploadImageCallBack) { | ||
| 705 | - weakSelf.endUploadImageCallBack(); | ||
| 706 | - } | ||
| 707 | - } | ||
| 708 | - if (weakSelf.changeUploadDataCallBack) { | ||
| 709 | - weakSelf.changeUploadDataCallBack([weakSelf getCurrentSelectImageUrls], [weakSelf getCurrentSelectVideoUrl]); | ||
| 710 | - } | ||
| 711 | - }]; | ||
| 712 | - [self resetUI]; | ||
| 713 | - [self autoAdjustHeight]; | ||
| 714 | - | ||
| 715 | - self.uploadingCount = self.uploadingCount + 1; | ||
| 716 | - if (self.uploadingCount == 1) { | ||
| 717 | - if (self.beginUploadImageCallBack) { | ||
| 718 | - self.beginUploadImageCallBack(); | 702 | + self.uploadVideoModel?.uploadKey = UploadManager.uploadVideo(videoData: videoData, progressBlock: { [weak self] key, progress in |
| 703 | + self!.uploadVideoModel?.uploadingPercent = progress | ||
| 704 | + self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!) | ||
| 705 | + }, successBlock: { [weak self] key,url in | ||
| 706 | + self?.uploadVideoModel?.videoUrl = url | ||
| 707 | + self?.uploadVideoModel?.isUploading = false | ||
| 708 | + self?.uploadVideoModel?.uploadKey = nil | ||
| 709 | + self?.replaceVideoModelInSubviews(model: (self?.uploadVideoModel)!, target: firstImage.first!) | ||
| 710 | + self?.uploadingCount = self!.uploadingCount - 1 | ||
| 711 | + if self?.uploadingCount == 0{ | ||
| 712 | + self?.endUploadImageCallBack!() | ||
| 719 | } | 713 | } |
| 714 | + self?.changeUploadDataCallBack!((self?.getCurrentSelectImageUrls())!,(self?.getCurrentSelectVideoUrl())!) | ||
| 715 | + }) | ||
| 716 | + self.resetUI() | ||
| 717 | + self.autoAdjustHeight() | ||
| 718 | + self.uploadingCount = self.uploadingCount + 1 | ||
| 719 | + if self.uploadingCount == 1{ | ||
| 720 | + self.beginUploadImageCallBack!() | ||
| 720 | } | 721 | } |
| 721 | } | 722 | } |
| 722 | } | 723 | } |
| 723 | - } | ||
| 724 | - } | ||
| 725 | - pickerController.dismiss(animated: true) | ||
| 726 | - } | ||
| 727 | - | ||
| 728 | - // MARK: - TZImagePickerControllerDelegate | ||
| 729 | - - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto | ||
| 730 | - { | ||
| 731 | - [photos enumerateObjectsUsingBlock:^(UIImage * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | ||
| 732 | - UIImage * image = obj; | ||
| 733 | - | ||
| 734 | - DSSelectUploadImageModel * model = [[DSSelectUploadImageModel alloc] init]; | ||
| 735 | - model.image = image; | ||
| 736 | - model.isUploading = YES; | ||
| 737 | - DS_WEAK_SELF(self); | ||
| 738 | - model.uploadKey = [[DSQiNiuUploadManager sharedManager] uploadImageData:UIImageJPEGRepresentation(image, 0.5) uploadProgress:^(NSString * _Nonnull key, CGFloat percent) { | ||
| 739 | - model.uploadingPercent = percent; | ||
| 740 | - [weakSelf replaceImageModelInDataArr:model target:image]; | ||
| 741 | - } complete:^(NSString * _Nonnull key, DSQiNiuUploadResult result, NSString * _Nonnull imageUrl, NSString * _Nonnull errorMessage) { | ||
| 742 | - if (errorMessage) { | ||
| 743 | - DS_showMessage(errorMessage); | ||
| 744 | - [weakSelf.uploadImageUrls removeObject:model]; | ||
| 745 | - }else { | ||
| 746 | - model.imageUrl = imageUrl; | ||
| 747 | - model.isUploading = NO; | ||
| 748 | - model.uploadKey = nil; | ||
| 749 | - [weakSelf replaceImageModelInDataArr:model target:image]; | ||
| 750 | - } | ||
| 751 | - | ||
| 752 | - weakSelf.uploadingCount = weakSelf.uploadingCount - 1; | ||
| 753 | - if (weakSelf.uploadingCount == 0) { | ||
| 754 | - if (weakSelf.endUploadImageCallBack) { | ||
| 755 | - weakSelf.endUploadImageCallBack(); | 724 | + }else if asset.mediaType == .photo{ |
| 725 | + let image = asset.localImageAsset?.image | ||
| 726 | + let imageData = asset.localImageAsset?.imageData | ||
| 727 | + var model = CNLiveSelectUploadImageModel() | ||
| 728 | + model.image = image | ||
| 729 | + model.isUploading = true | ||
| 730 | + | ||
| 731 | + self.uploadVideoModel?.uploadKey = UploadManager.uploadImage(imageData: imageData! as NSData) { [weak self] key, percent in | ||
| 732 | + model.uploadingPercent = percent | ||
| 733 | + self?.replaceImageModelInDataArr(model: model, target: image!) | ||
| 734 | + } successBlock: { key, url in | ||
| 735 | + model.imageUrl = url | ||
| 736 | + model.isUploading = false | ||
| 737 | + model.uploadKey = nil | ||
| 738 | + self.replaceImageModelInDataArr(model: model, target: image!) | ||
| 739 | + | ||
| 740 | + self.uploadingCount = self.uploadingCount - 1 | ||
| 741 | + | ||
| 742 | + if self.uploadingCount == 0{ | ||
| 743 | + self.endUploadImageCallBack!() | ||
| 756 | } | 744 | } |
| 745 | + self.changeUploadDataCallBack!(self.getCurrentSelectImageUrls(),self.getCurrentSelectVideoUrl()) | ||
| 757 | } | 746 | } |
| 758 | - if (weakSelf.changeUploadDataCallBack) { | ||
| 759 | - weakSelf.changeUploadDataCallBack([weakSelf getCurrentSelectImageUrls], [weakSelf getCurrentSelectVideoUrl]); | ||
| 760 | - } | ||
| 761 | - }]; | ||
| 762 | - [self.uploadImageUrls addObject:model]; | ||
| 763 | - [self resetUI]; | ||
| 764 | - [self autoAdjustHeight]; | ||
| 765 | - | ||
| 766 | - self.uploadingCount = self.uploadingCount + 1; | ||
| 767 | - if (self.uploadingCount == 1) { | ||
| 768 | - if (self.beginUploadImageCallBack) { | ||
| 769 | - self.beginUploadImageCallBack(); | 747 | + self.uploadImageUrls.append(model) |
| 748 | + self.resetUI() | ||
| 749 | + self.autoAdjustHeight() | ||
| 750 | + self.uploadingCount = self.uploadingCount + 1 | ||
| 751 | + if self.uploadingCount == 1{ | ||
| 752 | + self.beginUploadImageCallBack!() | ||
| 770 | } | 753 | } |
| 771 | } | 754 | } |
| 772 | - }]; | 755 | + } |
| 756 | + pickerController.dismiss(animated: true) | ||
| 773 | } | 757 | } |
| 758 | + | ||
| 774 | // MARK: - 获取视频的第一帧 | 759 | // MARK: - 获取视频的第一帧 |
| 775 | func splitVideoFileUrlFps(splitFileUrl: URL, fps: Float, splitCompleteClosure: @escaping (Bool, [UIImage]) -> Void) { | 760 | func splitVideoFileUrlFps(splitFileUrl: URL, fps: Float, splitCompleteClosure: @escaping (Bool, [UIImage]) -> Void) { |
| 776 | 761 |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveSelUplSingleImageView.swift
| @@ -232,7 +232,7 @@ class CNLiveSelUplSingleImageView: UIView { | @@ -232,7 +232,7 @@ class CNLiveSelUplSingleImageView: UIView { | ||
| 232 | 232 | ||
| 233 | // MARK: - 触发事件 | 233 | // MARK: - 触发事件 |
| 234 | @objc func selfTap(){ | 234 | @objc func selfTap(){ |
| 235 | - self.clickCallBack!(self.model) | 235 | + self.clickCallBack!(self.model!) |
| 236 | } | 236 | } |
| 237 | @objc func deleteBtnClick(){ | 237 | @objc func deleteBtnClick(){ |
| 238 | self.clickDeleteCallBack!(self.model!) | 238 | self.clickDeleteCallBack!(self.model!) |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
| @@ -149,7 +149,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg | @@ -149,7 +149,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg | ||
| 149 | 149 | ||
| 150 | private func setupWithContentUploadImage(resultUploadImageBlock: @escaping resultUploadImageBlock) { | 150 | private func setupWithContentUploadImage(resultUploadImageBlock: @escaping resultUploadImageBlock) { |
| 151 | if select_image != nil { | 151 | if select_image != nil { |
| 152 | - UploadManager.uploadImage(imageData: select_image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in | 152 | + let uploadKey = UploadManager.uploadImage(imageData: select_image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in |
| 153 | print("获取进度==>\(progress)") | 153 | print("获取进度==>\(progress)") |
| 154 | }, successBlock: { key,url in | 154 | }, successBlock: { key,url in |
| 155 | resultUploadImageBlock(url) | 155 | resultUploadImageBlock(url) |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineShopViewController.swift
| @@ -258,7 +258,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | @@ -258,7 +258,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | ||
| 258 | self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .two, listModel: _listModel, tempArray: temp_array), animated: true) | 258 | self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .two, listModel: _listModel, tempArray: temp_array), animated: true) |
| 259 | return | 259 | return |
| 260 | } | 260 | } |
| 261 | - UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in | 261 | + let uploadKey = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in |
| 262 | print("获取进度==>\(progress)") | 262 | print("获取进度==>\(progress)") |
| 263 | }, successBlock: { [self] key,url in | 263 | }, successBlock: { [self] key,url in |
| 264 | hiddenLoading() | 264 | hiddenLoading() |
| @@ -309,10 +309,10 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | @@ -309,10 +309,10 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | ||
| 309 | self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .three, listModel: _listModel, tempArray: temp_array), animated: true) | 309 | self.navigationController?.pushViewController(CNLiveMineShopViewController.init(showType: .three, listModel: _listModel, tempArray: temp_array), animated: true) |
| 310 | return | 310 | return |
| 311 | } | 311 | } |
| 312 | - UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in | 312 | + let uploadKey = UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in |
| 313 | temp_dict_one.removeObject(forKey: "content") | 313 | temp_dict_one.removeObject(forKey: "content") |
| 314 | temp_dict_one.setObject(url, forKey: "content" as NSCopying) | 314 | temp_dict_one.setObject(url, forKey: "content" as NSCopying) |
| 315 | - UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in | 315 | + let uploadKey = UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in |
| 316 | hiddenLoading() | 316 | hiddenLoading() |
| 317 | temp_dict_two.removeObject(forKey: "content") | 317 | temp_dict_two.removeObject(forKey: "content") |
| 318 | temp_dict_two.setObject(url, forKey: "content" as NSCopying) | 318 | temp_dict_two.setObject(url, forKey: "content" as NSCopying) |
| @@ -364,7 +364,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | @@ -364,7 +364,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | ||
| 364 | uploadWithMessage() | 364 | uploadWithMessage() |
| 365 | return | 365 | return |
| 366 | } | 366 | } |
| 367 | - UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in | 367 | + let uploadKey = UploadManager.uploadImage(imageData: image_one.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in |
| 368 | temp_dict_one.removeObject(forKey: "content") | 368 | temp_dict_one.removeObject(forKey: "content") |
| 369 | temp_dict_one.setObject(url, forKey: "content" as NSCopying) | 369 | temp_dict_one.setObject(url, forKey: "content" as NSCopying) |
| 370 | if image_two == nil { | 370 | if image_two == nil { |
| @@ -372,7 +372,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | @@ -372,7 +372,7 @@ class CNLiveMineShopViewController : CNLiveBaseViewController, UITextViewDelegat | ||
| 372 | temp_array.addObjects(from: threeArray as! [Any]) | 372 | temp_array.addObjects(from: threeArray as! [Any]) |
| 373 | uploadWithMessage() | 373 | uploadWithMessage() |
| 374 | }else{ | 374 | }else{ |
| 375 | - UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in | 375 | + let uploadKey = UploadManager.uploadImage(imageData: image_two.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in }, successBlock: { [self] key,url in |
| 376 | hiddenLoading() | 376 | hiddenLoading() |
| 377 | temp_dict_two.removeObject(forKey: "content") | 377 | temp_dict_two.removeObject(forKey: "content") |
| 378 | temp_dict_two.setObject(url, forKey: "content" as NSCopying) | 378 | temp_dict_two.setObject(url, forKey: "content" as NSCopying) |
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
| @@ -256,7 +256,7 @@ extension MinePhotoUploadView { | @@ -256,7 +256,7 @@ extension MinePhotoUploadView { | ||
| 256 | if let image = image { | 256 | if let image = image { |
| 257 | self!.temp_imageView.image = image | 257 | self!.temp_imageView.image = image |
| 258 | if self!.temp_imageView == self!.imageView01 { | 258 | if self!.temp_imageView == self!.imageView01 { |
| 259 | - UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in | 259 | + let uploadKey = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in |
| 260 | print("获取进度==>\(progress)") | 260 | print("获取进度==>\(progress)") |
| 261 | }, successBlock: { [weak self] key,url in | 261 | }, successBlock: { [weak self] key,url in |
| 262 | self!.imageView02.isHidden = false | 262 | self!.imageView02.isHidden = false |
| @@ -265,7 +265,7 @@ extension MinePhotoUploadView { | @@ -265,7 +265,7 @@ extension MinePhotoUploadView { | ||
| 265 | }) | 265 | }) |
| 266 | } | 266 | } |
| 267 | if self!.temp_imageView == self!.imageView02 { | 267 | if self!.temp_imageView == self!.imageView02 { |
| 268 | - UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in | 268 | + let uploadKey = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in |
| 269 | print("获取进度==>\(progress)") | 269 | print("获取进度==>\(progress)") |
| 270 | }, successBlock: { [weak self] key,url in | 270 | }, successBlock: { [weak self] key,url in |
| 271 | self!.imageView03.isHidden = false | 271 | self!.imageView03.isHidden = false |
| @@ -274,7 +274,7 @@ extension MinePhotoUploadView { | @@ -274,7 +274,7 @@ extension MinePhotoUploadView { | ||
| 274 | }) | 274 | }) |
| 275 | } | 275 | } |
| 276 | if self!.temp_imageView == self!.imageView03 { | 276 | if self!.temp_imageView == self!.imageView03 { |
| 277 | - UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in | 277 | + let uploadKey = UploadManager.uploadImage(imageData: image.jpegData(compressionQuality: 1.0)! as NSData, progressBlock: {key, progress in |
| 278 | print("获取进度==>\(progress)") | 278 | print("获取进度==>\(progress)") |
| 279 | }, successBlock: { [weak self] key,url in | 279 | }, successBlock: { [weak self] key,url in |
| 280 | self!.selectedImages.replaceObject(at: 2, with: image) | 280 | self!.selectedImages.replaceObject(at: 2, with: image) |