南鑫林 il y a 5 ans
Parent
commit
ec14f7916c
22 fichiers modifiés avec 766 ajouts et 422 suppressions
  1. 42 14
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 13 10
      RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift
  3. 46 0
      RainbowPlanet/RainbowPlanet/Manager/AliyunVodManager/AliyunVodUpToyoPublishManager/AliyunVodUpToYoPublishModel.swift
  4. 324 0
      RainbowPlanet/RainbowPlanet/Manager/AliyunVodManager/AliyunVodUpToyoPublishManager/AliyunVodupToyoPublishManager.swift
  5. 23 23
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishManager/PublishUploadProgressView.swift
  6. 191 0
      RainbowPlanet/RainbowPlanet/Manager/PathManager/PathManager.swift
  7. 1 3
      RainbowPlanet/RainbowPlanet/Manager/WebViewJavascriptBridgeManager/WebViewJavascriptBridgeManager.swift
  8. 40 0
      RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityImageAuthModel.swift
  9. 1 29
      RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityVideoAuthModel.swift
  10. 1 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/CommunityNavigationBarView.swift
  11. 8 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  12. 3 12
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift
  13. 5 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift
  14. 9 5
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageList/ViewController/MessageListController.swift
  15. 10 5
      RainbowPlanet/RainbowPlanet/Modules/MineModule/MyFollowAndFan/ViewController/MyFollowAndFanViewController.swift
  16. 5 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/ViewController/UserPersonalCenterViewController.swift
  17. 5 5
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/PathManager/AliyunPathManager.m
  18. 30 7
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEdit/Controller/PublishEditController.swift
  19. 0 299
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishManager/PublishUploadManager.swift
  20. 2 3
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/ViewController/SearchContentListViewController.swift
  21. 6 3
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift
  22. 1 0
      RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

+ 42 - 14
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -438,6 +438,7 @@
 		A7E19FAC22BA2D01009BCCE1 /* SearchTopicListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E19FAB22BA2D01009BCCE1 /* SearchTopicListViewController.swift */; };
 		A7E19FAE22BA2D16009BCCE1 /* SearchContentListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E19FAD22BA2D16009BCCE1 /* SearchContentListViewController.swift */; };
 		A7E19FB122BA3A0D009BCCE1 /* SearchTopicListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E19FB022BA3A0D009BCCE1 /* SearchTopicListTableViewCell.swift */; };
+		A7EF3E0C23013EDE001E4D26 /* CommunityImageAuthModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EF3E0B23013EDE001E4D26 /* CommunityImageAuthModel.swift */; };
 		A7F2D6BD22B09F930093000B /* CommunityNavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F2D6BC22B09F930093000B /* CommunityNavigationBarView.swift */; };
 		A7F2D6C122B0D1CB0093000B /* CommunityFollowTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F2D6C022B0D1CB0093000B /* CommunityFollowTableHeaderView.swift */; };
 		A7F2D6C622B0DC7B0093000B /* CommunityCommonSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F2D6C522B0DC7B0093000B /* CommunityCommonSectionHeaderView.swift */; };
@@ -457,6 +458,9 @@
 		A7F577C422FD894F00E2D757 /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A7F577C122FD894F00E2D757 /* ATAuthSDK.bundle */; };
 		A7F577C522FD894F00E2D757 /* TYRZResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A7F577C222FD894F00E2D757 /* TYRZResource.bundle */; };
 		A7F577C822FE96C600E2D757 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A7F577C722FE96C600E2D757 /* Launch Screen.storyboard */; };
+		A7F577CD22FECD7C00E2D757 /* AliyunVodupToyoPublishManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F577CC22FECD7C00E2D757 /* AliyunVodupToyoPublishManager.swift */; };
+		A7F577D122FECE8700E2D757 /* AliyunVodUpToYoPublishModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F577D022FECE8700E2D757 /* AliyunVodUpToYoPublishModel.swift */; };
+		A7F577D722FED3A100E2D757 /* PathManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F577D622FED3A100E2D757 /* PathManager.swift */; };
 		A7FF1555228AC27600A85748 /* ProductAllCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1554228AC27600A85748 /* ProductAllCommentView.swift */; };
 		A7FF1557228AC3E800A85748 /* ProductAllCommentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1556228AC3E800A85748 /* ProductAllCommentViewController.swift */; };
 		A7FF1560228C693D00A85748 /* OrderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF155F228C693D00A85748 /* OrderViewController.swift */; };
@@ -631,7 +635,6 @@
 		BD929CCE22B904A30098C139 /* PublishViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD929CCD22B904A30098C139 /* PublishViewController.swift */; };
 		BD981A8F22C9FEEF0043D951 /* CommunityPublishModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD981A8E22C9FEEF0043D951 /* CommunityPublishModel.swift */; };
 		BDA45BFF22E45EBC009DE548 /* PublishUploadProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA45BFE22E45EBC009DE548 /* PublishUploadProgressView.swift */; };
-		BDA45C0122E47283009DE548 /* PublishUploadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA45C0022E47283009DE548 /* PublishUploadManager.swift */; };
 		BDAA40F7228E947500CF841D /* OrderApplyRefundAccountCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAA40F6228E947500CF841D /* OrderApplyRefundAccountCell.swift */; };
 		BDAA40F9228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAA40F8228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift */; };
 		BDAA40FB228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAA40FA228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift */; };
@@ -1162,6 +1165,7 @@
 		A7E19FAB22BA2D01009BCCE1 /* SearchTopicListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTopicListViewController.swift; sourceTree = "<group>"; };
 		A7E19FAD22BA2D16009BCCE1 /* SearchContentListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchContentListViewController.swift; sourceTree = "<group>"; };
 		A7E19FB022BA3A0D009BCCE1 /* SearchTopicListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTopicListTableViewCell.swift; sourceTree = "<group>"; };
+		A7EF3E0B23013EDE001E4D26 /* CommunityImageAuthModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityImageAuthModel.swift; sourceTree = "<group>"; };
 		A7F2D6BC22B09F930093000B /* CommunityNavigationBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityNavigationBarView.swift; sourceTree = "<group>"; };
 		A7F2D6C022B0D1CB0093000B /* CommunityFollowTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFollowTableHeaderView.swift; sourceTree = "<group>"; };
 		A7F2D6C522B0DC7B0093000B /* CommunityCommonSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityCommonSectionHeaderView.swift; sourceTree = "<group>"; };
@@ -1182,6 +1186,9 @@
 		A7F577C122FD894F00E2D757 /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
 		A7F577C222FD894F00E2D757 /* TYRZResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TYRZResource.bundle; sourceTree = "<group>"; };
 		A7F577C722FE96C600E2D757 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
+		A7F577CC22FECD7C00E2D757 /* AliyunVodupToyoPublishManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AliyunVodupToyoPublishManager.swift; sourceTree = "<group>"; };
+		A7F577D022FECE8700E2D757 /* AliyunVodUpToYoPublishModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AliyunVodUpToYoPublishModel.swift; sourceTree = "<group>"; };
+		A7F577D622FED3A100E2D757 /* PathManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PathManager.swift; sourceTree = "<group>"; };
 		A7FF1554228AC27600A85748 /* ProductAllCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductAllCommentView.swift; sourceTree = "<group>"; };
 		A7FF1556228AC3E800A85748 /* ProductAllCommentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductAllCommentViewController.swift; sourceTree = "<group>"; };
 		A7FF155F228C693D00A85748 /* OrderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderViewController.swift; sourceTree = "<group>"; };
@@ -1404,7 +1411,6 @@
 		BD929CCD22B904A30098C139 /* PublishViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishViewController.swift; sourceTree = "<group>"; };
 		BD981A8E22C9FEEF0043D951 /* CommunityPublishModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityPublishModel.swift; sourceTree = "<group>"; };
 		BDA45BFE22E45EBC009DE548 /* PublishUploadProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishUploadProgressView.swift; sourceTree = "<group>"; };
-		BDA45C0022E47283009DE548 /* PublishUploadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishUploadManager.swift; sourceTree = "<group>"; };
 		BDAA40F6228E947500CF841D /* OrderApplyRefundAccountCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderApplyRefundAccountCell.swift; sourceTree = "<group>"; };
 		BDAA40F8228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderApplyRefundReasonCell.swift; sourceTree = "<group>"; };
 		BDAA40FA228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderApplyRefundNoteInfoCell.swift; sourceTree = "<group>"; };
@@ -2317,6 +2323,8 @@
 		A72A725422321B9400B21995 /* Manager */ = {
 			isa = PBXGroup;
 			children = (
+				A7F577D522FED33500E2D757 /* PathManager */,
+				A7F577CB22FECD2B00E2D757 /* AliyunVodManager */,
 				A72E685722F2DAF40063D967 /* RegisterLoginManager */,
 				A72E685222F2D7460063D967 /* ATAuthSDKManager */,
 				A74DF74B22EAEF43007FB505 /* MJRefreshManager */,
@@ -4292,6 +4300,7 @@
 				A71CAB3A22C9F21100D908A8 /* CommunityMemberFollowTopicListModel.swift */,
 				BD981A8E22C9FEEF0043D951 /* CommunityPublishModel.swift */,
 				BD0F61F722CAFC8B004650FB /* CommunityVideoAuthModel.swift */,
+				A7EF3E0B23013EDE001E4D26 /* CommunityImageAuthModel.swift */,
 				BDE8AD1522CC59EE00E03C65 /* CommunityVideoListModel.swift */,
 				A7C2566E22CB7A0C00420828 /* CommunityPostDetailModel.swift */,
 				A7C2567B22CD8EEE00420828 /* CommunityPostCommentsModel.swift */,
@@ -4575,6 +4584,32 @@
 			path = ShareCommonStr;
 			sourceTree = "<group>";
 		};
+		A7F577CB22FECD2B00E2D757 /* AliyunVodManager */ = {
+			isa = PBXGroup;
+			children = (
+				A7F577CE22FECDB000E2D757 /* AliyunVodUpToyoPublishManager */,
+			);
+			path = AliyunVodManager;
+			sourceTree = "<group>";
+		};
+		A7F577CE22FECDB000E2D757 /* AliyunVodUpToyoPublishManager */ = {
+			isa = PBXGroup;
+			children = (
+				BDA45BFE22E45EBC009DE548 /* PublishUploadProgressView.swift */,
+				A7F577CC22FECD7C00E2D757 /* AliyunVodupToyoPublishManager.swift */,
+				A7F577D022FECE8700E2D757 /* AliyunVodUpToYoPublishModel.swift */,
+			);
+			path = AliyunVodUpToyoPublishManager;
+			sourceTree = "<group>";
+		};
+		A7F577D522FED33500E2D757 /* PathManager */ = {
+			isa = PBXGroup;
+			children = (
+				A7F577D622FED3A100E2D757 /* PathManager.swift */,
+			);
+			path = PathManager;
+			sourceTree = "<group>";
+		};
 		A7FF1550228AC22700A85748 /* ProductAllComment */ = {
 			isa = PBXGroup;
 			children = (
@@ -4906,7 +4941,6 @@
 				BD13B69F22B9CE8D008BB323 /* PublishEdit */,
 				BD13B6CF22BA03BB008BB323 /* PublishAddTopic */,
 				BD13B6CB22BA03BB008BB323 /* PublishAddAddress */,
-				BDA45BFD22E45DDD009DE548 /* PublishManager */,
 				A7271DA722EFF5D400740C1A /* Unused */,
 			);
 			path = PublishModule;
@@ -5519,15 +5553,6 @@
 			path = AdressCell;
 			sourceTree = "<group>";
 		};
-		BDA45BFD22E45DDD009DE548 /* PublishManager */ = {
-			isa = PBXGroup;
-			children = (
-				BDA45C0022E47283009DE548 /* PublishUploadManager.swift */,
-				BDA45BFE22E45EBC009DE548 /* PublishUploadProgressView.swift */,
-			);
-			path = PublishManager;
-			sourceTree = "<group>";
-		};
 		BDAF83AE22B3B6150004BCC3 /* AllCommentCell */ = {
 			isa = PBXGroup;
 			children = (
@@ -5598,8 +5623,8 @@
 		BDE376CB22C2284C0055E2EA /* AlivcShortVideo */ = {
 			isa = PBXGroup;
 			children = (
-				BDD547B622C2FF4D005BBE19 /* ShortVideoCommonFile */,
 				BDD547B722C2FF66005BBE19 /* ShortVideoFile */,
+				BDD547B622C2FF4D005BBE19 /* ShortVideoCommonFile */,
 				BDD547B822C2FF82005BBE19 /* ShortVideoResource */,
 			);
 			path = AlivcShortVideo;
@@ -6066,6 +6091,7 @@
 				A71AA5152272160A008FF1A5 /* ExpressAddressListTableViewCell.swift in Sources */,
 				A72A72B722321DE000B21995 /* Extension+NSMutableAttributedString.swift in Sources */,
 				A7931E0D22AF874600297D0A /* GenderSelectionViewController.swift in Sources */,
+				A7F577D122FECE8700E2D757 /* AliyunVodUpToYoPublishModel.swift in Sources */,
 				A7C0FDF522B65FE000BC1E86 /* FeaturedTopicsCollectionViewCell.swift in Sources */,
 				A7BB6857226965C100AB07A2 /* SelfRecommendationHeaderCollectionReusableView.swift in Sources */,
 				BDE3045F228554CA001D050F /* ProductCartAmountModel.swift in Sources */,
@@ -6222,6 +6248,7 @@
 				BD01B20222BC677900CE9F36 /* PublishVideoView.swift in Sources */,
 				A7C0FDF322B65E5400BC1E86 /* FeaturedTopicsTableViewCell.swift in Sources */,
 				A770E61322D6625700CBD0A4 /* ShareCommunityViewCollectionViewCell.swift in Sources */,
+				A7F577D722FED3A100E2D757 /* PathManager.swift in Sources */,
 				A7D77DEE22DDDDDB0048D5F6 /* RedemptionAreaViewModel.swift in Sources */,
 				A7A98E0B227EBD04005306E9 /* CategorySearchView.swift in Sources */,
 				A72A73142232475E00B21995 /* AlipayManager.swift in Sources */,
@@ -6260,6 +6287,7 @@
 				A70B2C75228920BA00B2449F /* ProductDetailSkuSectionHeaerCollectionReusableView.swift in Sources */,
 				A7DF50D822A4FAFC00998908 /* ProductDetailEvaluationImageCollectionViewCell.swift in Sources */,
 				A7C0FDE922B4BC5600BC1E86 /* CardContentCommentListContentTableViewCell.swift in Sources */,
+				A7EF3E0C23013EDE001E4D26 /* CommunityImageAuthModel.swift in Sources */,
 				BD12B67C22B4EE6D00AEB10B /* KSMediaPickerAlbumModel.swift in Sources */,
 				A72843FC224DB6B800F82F30 /* SwiftMoyaServiceUserApi.swift in Sources */,
 				BD6122AF22C3638300D3F513 /* AliyunEffectMvGroup.m in Sources */,
@@ -6291,6 +6319,7 @@
 				A7D77DE722DDBE4D0048D5F6 /* RedemptionAreaBannerCollectionViewCell.swift in Sources */,
 				A7D5F24D22BC720000F8E9AF /* WVJBModel.swift in Sources */,
 				A74322A222B8D5A90017C367 /* SearchUserLitTableViewCell.swift in Sources */,
+				A7F577CD22FECD7C00E2D757 /* AliyunVodupToyoPublishManager.swift in Sources */,
 				A72623E522C39C7000AEF875 /* FMLinkLabel.m in Sources */,
 				A7CC75432271E038003C4F38 /* SelfMentionContactsListViewController.swift in Sources */,
 				A72E685622F2D80F0063D967 /* ATAuthSDKModel.swift in Sources */,
@@ -6444,7 +6473,6 @@
 				A7CC7516227161D5003C4F38 /* SetViewController.swift in Sources */,
 				A7D07CD422B789DE00186014 /* PersonViewUserAndOtherListView.swift in Sources */,
 				A7778CBA2244F14B00C7C47A /* Extension+UIViewController.swift in Sources */,
-				BDA45C0122E47283009DE548 /* PublishUploadManager.swift in Sources */,
 				BD13B6C322BA034D008BB323 /* PublishEditDescribeCell.swift in Sources */,
 				A7CC752C2271A1AE003C4F38 /* SetPasswordViewController.swift in Sources */,
 				BD10FBFE22C6F7D90096A34E /* AliyunPublishService.m in Sources */,

+ 13 - 10
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -76,19 +76,11 @@ class BaseTabbarViewController: NSObject {
         }
 
         esTabBarController.didHijackHandler = {
-            tabbarController, viewController, index in
+            [weak self] tabbarController, viewController, index in
             if UserModel.isTokenNil() {
                 kAppDelegate.setLogin()
             }else {
-                let isUploadFinish: Bool = PublishUploadManager.shared().isPublishFinished
-                if isUploadFinish {
-                    let pickVc = PublishViewController()
-                    let nav = BaseNavigationViewController.init(rootViewController: pickVc)
-                    tabbarController.present(nav, animated: true, completion: nil)
-                    
-                } else {
-                    SwiftProgressHUD.shared().showText("内容上传中,请稍等", textAlignment: .center)
-                }
+                self?.pushPublishVC()
             }
         }
         
@@ -159,6 +151,17 @@ class BaseTabbarViewController: NSObject {
         return esTabBarController
     }
     
+    /// 跳转到VC
+    func pushPublishVC() {
+        if BaseTabbarViewController.shared.v1.navigationBarbgView.isHidden {
+            let pickVc = PublishViewController()
+            let nav = BaseNavigationViewController.init(rootViewController: pickVc)
+            BaseTabbarViewController.shared.esTabBarController.present(nav, animated: true, completion: nil)
+        } else {
+            SwiftProgressHUD.shared().showText("内容上传中,请稍等", textAlignment: .center)
+        }
+    }
+    
     // 设置Badge
     func setBadge() {
         //消息

+ 46 - 0
RainbowPlanet/RainbowPlanet/Manager/AliyunVodManager/AliyunVodUpToyoPublishManager/AliyunVodUpToYoPublishModel.swift

@@ -0,0 +1,46 @@
+//
+//  AliyunVodupToYoPublishModel.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/10.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class AliyunVodUpToYoPublishModel: NSObject {
+    
+    /// 发布类型
+    ///
+    /// - image: 图片
+    /// - video: 视频
+    enum PublishType {
+        case image
+        case video
+    }
+    
+    /// 上传到后端
+    var title: String?
+    var content: String?
+    var locationString: String?
+    var topicIds: Array<String>?
+    
+    //图片/视频
+    var publishType : PublishType?
+    
+    //图片
+    var images: Array<UIImage>?
+    var imageUrlPaths:Array<String>?
+    var imageUrls = Array<String>()
+    
+    //视频
+    var videoPath: String?
+    var videoCoverImage: UIImage?
+    var videoCoverImageUrlPath: String?
+    var pushVideoId: String?
+    var pushVideoCoverImageUrl: String?
+    
+    /// 授权凭证
+    var uploadAuth : String?
+    
+}

+ 324 - 0
RainbowPlanet/RainbowPlanet/Manager/AliyunVodManager/AliyunVodUpToyoPublishManager/AliyunVodupToyoPublishManager.swift

@@ -0,0 +1,324 @@
+//
+//  AliyunVodupToyoPublishManager.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/10.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import SwiftyJSON
+
+class AliyunVodUpToyoPublishManager: NSObject {
+    
+    deinit {
+        NXLLog("deinit")
+    }
+    
+    static let shared : AliyunVodUpToyoPublishManager = AliyunVodUpToyoPublishManager()
+    
+    /// 参数模型
+    var aliyunVodUpToYoPublishModel : AliyunVodUpToYoPublishModel?
+    
+    /// 进度条View
+    var progressView :PublishUploadProgressView?
+    
+    /// 是否上传视频
+    var isUploadingVideo: Bool = true
+    
+    /// 多图上传次数
+    var curTimes : Int = 0
+    
+    /// 多图上传的进度值
+    var imagesProgressValue : CGFloat = 0.0
+   
+    /// 阿里云上传发布管理
+    var aliyunVodPublishManager: AliyunVodPublishManager?
+    
+    /// 发布
+    ///
+    /// - Parameters:
+    ///   - aliyunVodUpToYoPublishModel: 发布参数
+    ///   - view: 发布View
+    func publish(aliyunVodUpToYoPublishModel:AliyunVodUpToYoPublishModel?,view:UIView?) {
+       
+        let aliyunVodPublishManager = AliyunVodPublishManager()
+        aliyunVodPublishManager.uploadCallback = self
+        self.aliyunVodPublishManager = aliyunVodPublishManager
+        self.aliyunVodUpToYoPublishModel = aliyunVodUpToYoPublishModel
+        progressView = PublishUploadProgressView.publishUploadProgressView(attachedView: view)
+        progressView?.attachedView?.isHidden = false
+        self.progressView?.curUploadStatus = nil
+        
+        if self.aliyunVodUpToYoPublishModel?.publishType == .video { //视频
+            progressView?.imageView.image = aliyunVodUpToYoPublishModel?.videoCoverImage
+            videoUploadAuth()
+        }else if self.aliyunVodUpToYoPublishModel?.publishType == .image  { //图片
+            writePhotosToFileAndSetPath()
+        }
+    }
+    
+    func destroy() {
+        self.aliyunVodUpToYoPublishModel = nil
+        self.isUploadingVideo = true
+        self.curTimes = 0
+        self.imagesProgressValue = 0.0
+        self.aliyunVodPublishManager = nil
+    }
+
+}
+// MARK: - video
+extension AliyunVodUpToyoPublishManager {
+    // 获取视频上传地址和凭证(视频)
+    func videoUploadAuth() {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityVideoUploadAuthApi(title: self.aliyunVodUpToYoPublishModel?.title ?? "", filename: "\(self.aliyunVodUpToYoPublishModel?.videoPath?.suffix(20) ?? "")", cover_url: self.aliyunVodUpToYoPublishModel?.videoCoverImageUrlPath ?? "", completion: {
+            [weak self] (communityVideoAuthModel) -> (Void) in
+            let communityVideoAuthModel = communityVideoAuthModel as? CommunityVideoAuthModel
+            self?.aliyunVodUpToYoPublishModel?.pushVideoId = communityVideoAuthModel?.videoId
+            self?.aliyunVodUpToYoPublishModel?.uploadAuth = communityVideoAuthModel?.uploadAuth
+            self?.uploadVideo(communityVideoAuthModel: communityVideoAuthModel)
+        }) { [weak self] _ in
+            self?.progressView?.attachedView?.isHidden = true
+            self?.destroy()
+        }
+    }
+    
+    /// 上传视频
+    ///
+    /// - Parameter communityVideoAuthModel: 上传地址和凭证(图片)
+    func uploadVideo(communityVideoAuthModel:CommunityVideoAuthModel?) {
+        //上传视频
+        aliyunVodPublishManager?.uploadVideo(withPath: self.aliyunVodUpToYoPublishModel?.videoPath ?? "", uploadAddress: communityVideoAuthModel?.uploadAddress ?? "", uploadAuth: communityVideoAuthModel?.uploadAuth ?? "")
+    }
+    // 获取视频上传地址和凭证(视频封面图片)
+    func videoCoverImageUploadAuth(){
+        SwiftMoyaNetWorkServiceCommunity.shared().communityImageUploadAuth(completion: {
+            [weak self] (communityImageAuthModel) -> (Void) in
+            let communityImageAuthModel = communityImageAuthModel as? CommunityImageAuthModel
+            
+            let imgWidth  = Int(self?.aliyunVodUpToYoPublishModel?.videoCoverImage?.size.width ?? 0)
+            let imgHeight = Int(self?.aliyunVodUpToYoPublishModel?.videoCoverImage?.size.height ?? 0)
+            let urlStr = String(format: "%@?%ld_%ld", communityImageAuthModel?.imageURL ?? "", imgWidth, imgHeight)
+            // 设置主图
+            self?.aliyunVodUpToYoPublishModel?.pushVideoCoverImageUrl = urlStr
+            self?.aliyunVodUpToYoPublishModel?.uploadAuth = communityImageAuthModel?.uploadAuth
+            self?.uploadVideoCoverImage(communityImageAuthModel: communityImageAuthModel)
+        }) {[weak self] _ in
+            self?.destroy()
+        }
+    }
+    
+    /// 上传视频封面图
+    ///
+    /// - Parameter communityVideoAuthModel: 上传地址和凭证(图片)
+    func uploadVideoCoverImage(communityImageAuthModel:CommunityImageAuthModel?) {
+        aliyunVodPublishManager?.uploadImage(withPath: self.aliyunVodUpToYoPublishModel?.videoCoverImageUrlPath ?? "", uploadAddress: communityImageAuthModel?.uploadAddress ?? "", uploadAuth: communityImageAuthModel?.uploadAuth ?? "")
+    }
+    
+    
+    // 发布视频
+    func publishVideo() {
+        
+        let topicJsonStr = JSON(self.aliyunVodUpToYoPublishModel?.topicIds as Any).description
+        let imgs = [self.aliyunVodUpToYoPublishModel?.pushVideoCoverImageUrl]
+        let imgsJsonStr = JSON(imgs as Any).description
+        
+        SwiftMoyaNetWorkServiceCommunity.shared().communityPublishApi(type: "video", img: self.aliyunVodUpToYoPublishModel?.pushVideoCoverImageUrl ?? "", topic_ids: topicJsonStr, video: self.aliyunVodUpToYoPublishModel?.pushVideoId ?? "", title: self.aliyunVodUpToYoPublishModel?.title ?? "", content: self.aliyunVodUpToYoPublishModel?.content ?? "", location: self.aliyunVodUpToYoPublishModel?.locationString ?? "", imgs: imgsJsonStr, completion: {
+            [weak self] (communityPublishModel) -> (Void) in
+            let communityPublishModel = communityPublishModel as? CommunityPublishModel
+            VirusViewModel.shared.publishVirueRecordAddApi(postId: communityPublishModel?.postId, postType: "video", title: self?.aliyunVodUpToYoPublishModel?.title, content: self?.aliyunVodUpToYoPublishModel?.content, postCover: self?.aliyunVodUpToYoPublishModel?.videoCoverImageUrlPath)
+            self?.progressView?.curUploadStatus = .success
+            self?.progressView?.attachedView?.isHidden = true
+            self?.destroy()
+        }) { [weak self] _ in
+            self?.progressView?.attachedView?.isHidden = true
+            self?.destroy()
+        }
+    }
+}
+
+// MARK: - image
+extension AliyunVodUpToyoPublishManager {
+    // 存储图片路径
+    func writePhotosToFileAndSetPath() {
+        if !(aliyunVodUpToYoPublishModel?.images?.isEmpty ?? true) {
+            var imageUrlPaths = Array<String>()
+            for image in (aliyunVodUpToYoPublishModel?.images)! {
+                let imagePath: String = (AliyunPathManager.compositionRootDir()?.appending(AliyunPathManager.randomString()))!
+
+                let imgData: Data? = UIImage.pngData(image)()
+                do {
+                    try imgData?.write(to: URL(fileURLWithPath: imagePath))
+                    imageUrlPaths.append(imagePath)
+                }
+                catch {
+                    NXLLog("存入失败")
+                }
+            }
+            
+            aliyunVodUpToYoPublishModel?.imageUrlPaths = imageUrlPaths
+            imageUploadAuth()
+        }
+    }
+    
+    // 获取上传地址和凭证(图片)
+    func imageUploadAuth(){
+        SwiftMoyaNetWorkServiceCommunity.shared().communityImageUploadAuth(completion: {
+            [weak self] (communityImageAuthModel) -> (Void) in
+            let communityImageAuthModel = communityImageAuthModel as? CommunityImageAuthModel
+            self?.progressView?.imageView.image = self?.aliyunVodUpToYoPublishModel?.images?[(self?.curTimes)!]
+            
+            let imgWidth  = Int(self?.aliyunVodUpToYoPublishModel?.images?[(self?.curTimes)!].size.width ?? 0)
+            let imgHeight = Int(self?.aliyunVodUpToYoPublishModel?.images?[(self?.curTimes)!].size.height ?? 0)
+            let urlStr = String(format: "%@?%ld_%ld", communityImageAuthModel?.imageURL ?? "", imgWidth, imgHeight)
+            self?.aliyunVodUpToYoPublishModel?.imageUrls.append(urlStr)
+            self?.aliyunVodUpToYoPublishModel?.uploadAuth = communityImageAuthModel?.uploadAuth
+            self?.uploadImage(communityImageAuthModel: communityImageAuthModel)
+        }) {[weak self] _ in
+            self?.progressView?.attachedView?.isHidden = true
+            self?.destroy()
+        }
+    }
+    
+    /// 上传图片
+    ///
+    /// - Parameter communityVideoAuthModel: 上传地址和凭证(图片)
+    func uploadImage(communityImageAuthModel:CommunityImageAuthModel?) {
+        if !(self.aliyunVodUpToYoPublishModel?.imageUrlPaths?.isEmpty ?? true) {
+             aliyunVodPublishManager?.uploadImage(withPath: self.aliyunVodUpToYoPublishModel?.imageUrlPaths?[(self.curTimes)] ?? "", uploadAddress: communityImageAuthModel?.uploadAddress ?? "", uploadAuth: communityImageAuthModel?.uploadAuth ?? "")
+        }else {
+            self.progressView?.attachedView?.isHidden = true
+            self.destroy()
+            SwiftProgressHUD.shared().showText("图片路径存储错误,请重新上传")
+        }
+       
+    }
+    
+    
+    // 发布图片
+    func publishImage() {
+        
+        let topicJsonStr = JSON(self.aliyunVodUpToYoPublishModel?.topicIds as Any).description
+        let imgsJsonStr = JSON(self.aliyunVodUpToYoPublishModel?.imageUrls as Any).description
+        
+        SwiftMoyaNetWorkServiceCommunity.shared().communityPublishApi(type: "image", img: self.aliyunVodUpToYoPublishModel?.imageUrls.first ?? "", topic_ids: topicJsonStr, title: self.aliyunVodUpToYoPublishModel?.title ?? "", content: self.aliyunVodUpToYoPublishModel?.content ?? "", location: self.aliyunVodUpToYoPublishModel?.locationString ?? "", imgs: imgsJsonStr, completion: {
+            [weak self] (communityPublishModel) -> (Void) in
+            let communityPublishModel = communityPublishModel as? CommunityPublishModel
+            VirusViewModel.shared.publishVirueRecordAddApi(postId: communityPublishModel?.postId, postType: "image", title: self?.aliyunVodUpToYoPublishModel?.title, content: self?.aliyunVodUpToYoPublishModel?.content, postCover: self?.aliyunVodUpToYoPublishModel?.imageUrls.first)
+            self?.progressView?.curUploadStatus = .success
+            self?.progressView?.attachedView?.isHidden = true
+            self?.destroy()
+        }) { [weak self] _ in
+            self?.progressView?.attachedView?.isHidden = true
+            self?.destroy()
+        }
+    }
+    
+}
+
+extension AliyunVodUpToyoPublishManager: AliyunIVodUploadCallback {
+    
+    /// 上传成功
+    ///
+    /// - Parameter manager: AliyunVodPublishManager
+    func publishManagerUploadSuccess(_ manager: AliyunVodPublishManager) {
+        if self.aliyunVodUpToYoPublishModel?.publishType == .video { //发布视频
+            if isUploadingVideo {
+                isUploadingVideo = false
+                videoCoverImageUploadAuth()
+            }else {
+                publishVideo()
+            }
+        }else if self.aliyunVodUpToYoPublishModel?.publishType == .image { //图片
+            // 图片上传流程
+            self.curTimes += 1
+            if self.curTimes < self.aliyunVodUpToYoPublishModel?.images?.count ?? 1 {
+                self.imagesProgressValue = CGFloat(CGFloat(self.curTimes)/CGFloat((self.aliyunVodUpToYoPublishModel?.images?.count ?? 1)))
+                // 继续上传
+                self.imageUploadAuth()
+            }else {
+                // 图片上传成功,去发布
+                self.publishImage()
+            }
+
+        }
+    }
+
+    /// 上传失败
+    ///
+    /// - Parameters:
+    ///   - manager: AliyunVodPublishManager
+    ///   - code: 错误码
+    ///   - message: 错误描述
+    func publishManager(_ manager: AliyunVodPublishManager, uploadFailedWithCode code: String, message: String) {
+        self.progressView?.curUploadStatus = .failure
+        self.destroy()
+        manager.cancelUpload()
+    }
+    
+    /// 上传进度
+    ///
+    /// - Parameters:
+    ///   - manager: AliyunVodPublishManager
+    ///   - uploadedSize: 已上传数据大小
+    ///   - totalSize: 所有数据大小
+    func publishManager(_ manager: AliyunVodPublishManager, uploadProgressWithUploadedSize uploadedSize: Int64, totalSize: Int64) {
+        let uploadedSizeStr = "\(uploadedSize)" as NSString
+        let totalSizeStr = "\(totalSize)" as NSString
+        self.progressView?.curUploadStatus = .uploading
+        if (manager.uploadState == .video) { //上传视频
+            if isUploadingVideo {
+                let progressValue : CGFloat = CGFloat(uploadedSizeStr.doubleValue / totalSizeStr.doubleValue / 2.0)
+                DispatchQueue.main.async(execute: {
+                    [weak self] in
+                    self?.progressView?.uploadProgress = progressValue
+                })
+
+            }else {
+                let progressValue : CGFloat = CGFloat(uploadedSizeStr.doubleValue / totalSizeStr.doubleValue / 2.0) + 0.5
+                DispatchQueue.main.async(execute: {
+                    [weak self] in
+                    self?.progressView?.uploadProgress = progressValue
+                })
+            }
+        }else {
+            if self.aliyunVodUpToYoPublishModel?.publishType == .video { //上传视频封面图
+                let progressValue : CGFloat = CGFloat(uploadedSizeStr.doubleValue / totalSizeStr.doubleValue / 2.0) + 0.5
+                DispatchQueue.main.async(execute: {
+                    [weak self] in
+                    self?.progressView?.uploadProgress = progressValue
+                })
+            }else if self.aliyunVodUpToYoPublishModel?.publishType == .image {
+                DispatchQueue.main.async(execute: {
+                    [weak self] in
+                    let imagesStr = "\(self?.aliyunVodUpToYoPublishModel?.images?.count ?? 1)" as NSString
+                    let progressValue : CGFloat = CGFloat(uploadedSizeStr.doubleValue / totalSizeStr.doubleValue / imagesStr.doubleValue) + (self?.imagesProgressValue ?? 0.0)
+                    // 更新进度
+                    self?.progressView?.uploadProgress = progressValue
+                })
+            }
+        }
+    }
+    
+    /// 上传token过期
+    ///
+    /// - Parameter manager: AliyunVodPublishManager
+    func publishManagerUploadTokenExpired(_ manager: AliyunVodPublishManager) {
+        manager.refresh(withUploadAuth: self.aliyunVodUpToYoPublishModel?.uploadAuth ?? "")
+    }
+    
+    /// 上传超时,开始尝试重试
+    ///
+    /// - Parameter manager: AliyunVodPublishManager
+    func publishManagerUploadRetry(_ manager: AliyunVodPublishManager) {
+        NXLLog("继续上传")
+    }
+
+    /// 重试成功,开始继续上传
+    ///
+    /// - Parameter manager: AliyunVodPublishManager
+    func publishManagerUploadRetryResume(_ manager: AliyunVodPublishManager) {
+        NXLLog("重试成功")
+    }
+    
+}

+ 23 - 23
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishManager/PublishUploadProgressView.swift

@@ -23,22 +23,7 @@ enum UploadStatus{
 
 class PublishUploadProgressView: FWPopupView {
     
-    var curUploadStatus : UploadStatus? {
-        didSet {
-            judgeShowStatus()
-        }
-    }
     
-    var uploadProgress: Float? {
-        didSet {
-            progressView.setProgress(self.uploadProgress ?? 0, animated: true)
-            
-            var progressValue: Float = self.uploadProgress ?? 0
-            progressValue = progressValue * 100
-            let proValueStr: String = String(format: "正在上传中%.0f%%", progressValue)
-            progressLabel.text = proValueStr
-        }
-    }
     
     let disposeBag = DisposeBag()
     
@@ -46,12 +31,6 @@ class PublishUploadProgressView: FWPopupView {
         super.init(frame: frame)
         setupViews()
         setupLayouts()
-        
-
-    }
-    
-    @objc func adddtap() {
-        
     }
     
     required init?(coder aDecoder: NSCoder) {
@@ -138,11 +117,31 @@ class PublishUploadProgressView: FWPopupView {
         failedCloseButton.rx.tap.subscribe(onNext: { [weak self] (data) in
             self?.hide()
             self?.attachedView?.isHidden = true
+            
         }).disposed(by: disposeBag)
         return failedCloseButton
     }()
     
-    class func publishUploadProgressView(attachedView:UIView) -> PublishUploadProgressView {
+    var curUploadStatus : UploadStatus? {
+        didSet {
+            if curUploadStatus != nil {
+                judgeShowStatus()
+            }
+        }
+    }
+    
+    var uploadProgress: CGFloat? {
+        didSet {
+            progressView.setProgress(Float(self.uploadProgress ?? 0), animated: true)
+            
+            var progressValue: Float = Float(self.uploadProgress ?? 0)
+            progressValue = progressValue * 100
+            let proValueStr: String = String(format: "正在上传中%.0f%%", progressValue)
+            progressLabel.text = proValueStr
+        }
+    }
+    
+    class func publishUploadProgressView(attachedView:UIView?) -> PublishUploadProgressView {
         let view = PublishUploadProgressView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 62))
         view.curUploadStatus = .uploading
         let vProperty = FWPopupViewProperty()
@@ -150,7 +149,7 @@ class PublishUploadProgressView: FWPopupView {
         vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0 )
         vProperty.popupAnimationType = .frame
         vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
-        vProperty.touchWildToHide = "1"
+        vProperty.touchWildToHide = "0"
         vProperty.maskViewColor = UIColor.clear
         view.vProperty = vProperty
         view.attachedView = attachedView
@@ -162,6 +161,7 @@ class PublishUploadProgressView: FWPopupView {
 
 extension PublishUploadProgressView {
     
+    
     func judgeShowStatus() -> Void {
         switch curUploadStatus {
         case .uploading?:

+ 191 - 0
RainbowPlanet/RainbowPlanet/Manager/PathManager/PathManager.swift

@@ -0,0 +1,191 @@
+//
+//  PathManager.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/10.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class PathManager: NSObject {
+    
+    /// 获取程序的Home目录 ./
+    ///
+    /// - Returns: 获取程序的Home目录
+    private class func homePath() -> String? {
+        return NSHomeDirectory()
+    }
+    
+    /// 获取Documnets目录  ./Documents
+    ///
+    /// - Returns: 获取Documnets目录
+    private class func documentPath() -> String? {
+        return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first
+    }
+    
+    /// 获取Library目录 ./Library
+    ///
+    /// - Returns: 获取Library目录
+    private class func libraryPath() -> String? {
+        return NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true).first
+    }
+    
+    /// 获取Caches目录  ./Library/Caches
+    ///
+    /// - Returns: 获取Caches目录
+    private class func cachesPath() -> String? {
+        return NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first
+    }
+    
+    /// 获取tmp目录  ./tmp
+    ///
+    /// - Returns: 获取tmp目录
+    private class func tmpPath() -> String? {
+        return NSTemporaryDirectory()
+    }
+}
+
+extension PathManager {
+    
+    /// 获取caches文件夹大小
+    ///
+    /// - Returns: 获取cache文件夹大小
+    class func cachesPathSize() -> Double {
+        // 取出cache文件夹目录
+        let cachePath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first
+        
+        // 取出文件夹下所有文件数组
+        let fileArr = FileManager.default.subpaths(atPath: cachePath!)
+        
+        //快速枚举出所有文件名 计算文件大小
+        var size = 0
+        for file in fileArr! {
+            
+            // 把文件名拼接到路径中
+            let path = cachePath! + ("/\(file)")
+            // 取出文件属性
+            let floder = try! FileManager.default.attributesOfItem(atPath: path)
+            // 用元组取出文件大小属性
+            for (key, fileSize) in floder {
+                // 累加文件大小
+                if key == FileAttributeKey.size {
+                    size += (fileSize as AnyObject).integerValue
+                }
+            }
+        }
+        
+        let totalCache = Double(size) / 1024.00 / 1024.00
+        return totalCache
+    }
+    
+    /// 获取caches文件夹大小Str
+    ///
+    /// - Returns: 获取cache文件夹大小Str
+    class func cachesPathSizeString() -> String {
+        return String(format: "%.2f", cachesPathSize())
+    }
+    
+    
+}
+
+extension PathManager {
+    
+    /// 清除指定路径的文件
+    ///
+    /// - Parameter pathString: 清除指定路径的文件
+    class func clearPath(pathString:String) {
+        do {
+            try FileManager.default.removeItem(atPath: pathString)
+            try FileManager.default.createDirectory(atPath: pathString, withIntermediateDirectories: true, attributes: nil)
+        } catch {
+            NXLLog("清理\(pathString)失败")
+        }
+        
+    }
+    
+    /// 清理Caches目录
+    class func clearCachesPath() {
+        //取出cache文件夹目录
+        let fileArr = FileManager.default.subpaths(atPath: cachesPath()!)
+        // 遍历删除
+        for file in fileArr! {
+            let path = cachesPath()! + "/\(file)"
+            if FileManager.default.fileExists(atPath: path) {
+                do {
+                    try FileManager.default.removeItem(atPath: path)
+                } catch {
+                    NXLLog("清理\(file)失败")
+                }
+            }
+        }
+    }
+    
+}
+
+extension PathManager {
+    
+    /// 获取Documnets目录
+    ///
+    /// - Returns: 获取Documnets目录
+    class func projectDocumentPath() -> String? {
+        return "/" + (documentPath() ?? "") + Bundle.main.bundleIdentifier! + ".project"
+    }
+    
+    /// 获取Caches目录
+    ///
+    /// - Returns: 获取Caches目录
+    class func projectCachesPath() -> String? {
+        return "/" + (cachesPath() ?? "") + Bundle.main.bundleIdentifier! + ".project"
+    }
+    
+    /// 获取相对Documnets目录
+    ///
+    /// - Returns: 获取相对Documnets目录
+    class func projectRelativeDocumentPath() -> String? {
+        return "Documents/" + Bundle.main.bundleIdentifier! + "/.project"
+    }
+
+}
+
+extension PathManager {
+    /// 阿里云短视频合成文件目录
+    ///
+    /// - Returns: 阿里云短视频合成文件目录
+    class func aliyunVodCompositionPath() -> String? {
+        return (projectDocumentPath() ?? "") + "/composition/"
+    }
+    
+    /// 阿里云短视频记录目录
+    ///
+    /// - Returns: 阿里云短视频记录目录
+    class func aliyunVodCreateRecrodPath() -> String? {
+        return (projectDocumentPath() ?? "") + "/record/"
+    }
+    
+    /// 阿里云短视频资源目录
+    ///
+    /// - Returns: 阿里云短视频资源目录
+    class func aliyunVodCreateResourcePath() -> String? {
+        return (projectDocumentPath() ?? "") + "/resource/"
+    }
+    
+    /// 阿里云短视频资源目录
+    ///
+    /// - Returns: 阿里云短视频资源目录
+    class func aliyunVodRelativeResourcePath() -> String? {
+        return (projectRelativeDocumentPath() ?? "") + "/resource/"
+    }
+}
+
+extension PathManager {
+    /// 生成随机字符串
+    ///
+    /// - Returns: 随机字符串
+    class func randomString() -> String? {
+        let puuid = CFUUIDCreate(nil)
+        let uuidString = CFUUIDCreateString(nil, puuid)
+        let result = CFStringCreateCopy(nil, uuidString)
+        return result as String?
+    }
+}

+ 1 - 3
RainbowPlanet/RainbowPlanet/Manager/WebViewJavascriptBridgeManager/WebViewJavascriptBridgeManager.swift

@@ -86,9 +86,7 @@ class WebViewJavascriptBridgeManager: NSObject {
         if wvjbModel?.modelType  == .view {
             // 发布
             if wvjbModel?.params?.paramsModelPage == .publist {
-                let pickVc = PublishViewController()
-                let nav = BaseNavigationViewController.init(rootViewController: pickVc)
-                BaseTabbarViewController.shared.esTabBarController.present(nav, animated: true, completion: nil)
+                BaseTabbarViewController.shared.pushPublishVC()
             }
             // 推荐
             if wvjbModel?.params?.paramsModelPage == .join {

+ 40 - 0
RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityImageAuthModel.swift

@@ -0,0 +1,40 @@
+//
+//  CommunityImageAuthModel.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/12.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import ObjectMapper
+
+// MARK: - 图片
+class CommunityImageAuthModel : NSObject, Mappable{
+    
+    var fileURL : String?
+    var imageId : String?
+    var imageURL : String?
+    var requestId : String?
+    var uploadAddress : String?
+    var uploadAuth : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CommunityImageAuthModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        fileURL <- map["FileURL"]
+        imageId <- map["ImageId"]
+        imageURL <- map["ImageURL"]
+        requestId <- map["RequestId"]
+        uploadAddress <- map["UploadAddress"]
+        uploadAuth <- map["UploadAuth"]
+    }
+    
+}
+

+ 1 - 29
RainbowPlanet/RainbowPlanet/Model/CommunityModel/CommunityVideoAuthModel.swift

@@ -6,7 +6,7 @@
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
 //  获取上传地址和凭证のModel
 
-import Foundation
+import UIKit
 import ObjectMapper
 
 // MARK: - 视频
@@ -34,31 +34,3 @@ class CommunityVideoAuthModel : NSObject, Mappable{
     }    
 }
 
-// MARK: - 图片
-class CommunityImageAuthModel : NSObject, Mappable{
-    
-    var fileURL : String?
-    var imageId : String?
-    var imageURL : String?
-    var requestId : String?
-    var uploadAddress : String?
-    var uploadAuth : String?
-    
-    
-    class func newInstance(map: Map) -> Mappable?{
-        return CommunityImageAuthModel()
-    }
-    required init?(map: Map){}
-    private override init(){}
-    
-    func mapping(map: Map)
-    {
-        fileURL <- map["FileURL"]
-        imageId <- map["ImageId"]
-        imageURL <- map["ImageURL"]
-        requestId <- map["RequestId"]
-        uploadAddress <- map["UploadAddress"]
-        uploadAuth <- map["UploadAuth"]
-    }
-    
-}

+ 1 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/CommunityNavigationBarView.swift

@@ -121,9 +121,7 @@ class CommunityNavigationBarView: BaseView {
             if UserModel.isTokenNil() {
                 kAppDelegate.setLogin()
             }else {
-                let pickVc = PublishViewController()
-                let nav = BaseNavigationViewController.init(rootViewController: pickVc)
-                BaseTabbarViewController.shared.esTabBarController.present(nav, animated: true, completion: nil)
+                BaseTabbarViewController.shared.pushPublishVC()
             }
         }).disposed(by: disposeBag)
         return leftButton

+ 8 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -57,7 +57,7 @@ class CommunityFollowViewController: UIViewController {
     }()
     
     private lazy var followTableHeaderView: CommunityFollowTableHeaderView = {
-        let followTableHeaderView = CommunityFollowTableHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 286))
+        let followTableHeaderView = CommunityFollowTableHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 294))
         return followTableHeaderView
     }()
     
@@ -157,6 +157,11 @@ class CommunityFollowViewController: UIViewController {
                 self?.tableView.scrollToTop()
             }
         })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("PublishPostSuccess"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
 
     }
     
@@ -240,6 +245,8 @@ extension CommunityFollowViewController {
                 self?.communityFollowDataModels = (self?.communityFollowDataModels ?? Array<CommunityFollowDataModel>()) + (communityFollowFeedModel?.data ?? Array<CommunityFollowDataModel>())
                 if self?.communityFollowDataModels?.isEmpty ?? true {
                     self?.tableView.tableHeaderView = self?.followTableHeaderView
+                }else {
+                    self?.tableView.tableHeaderView = nil
                 }
                 self?.tableView.reloadData()
                 MJRefreshManager.mjRefreshManagerPaginationNoHiddenFooter(tableView: self?.tableView, pagination: communityFollowFeedModel?.pagination)

+ 3 - 12
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift

@@ -238,17 +238,8 @@ class CommunityViewController: BaseViewController {
         // 待发布
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("DismissFromPublishEditVc"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
             self?.reloadSegmentedFollowView()
-            self?.navigationBarbgView.isHidden = false            
-            let progressView = PublishUploadProgressView.publishUploadProgressView(attachedView: (self?.navigationBarbgView)!)
-            
-            let mediaType = notification.object as? PublishMediaType
-            if mediaType == PublishMediaType.video {
-               PublishUploadManager.shared().progressView = progressView
-               PublishUploadManager.shared().communityVideoUploadAuthApi()
-            } else {
-               PublishUploadManager.shared().progressView = progressView
-               PublishUploadManager.shared().communityImageUploadAuth(totalTimes: 0)
-            }
+            let aliyunVodUpToYoPublishModel = notification.object as? AliyunVodUpToYoPublishModel
+            AliyunVodUpToyoPublishManager.shared.publish(aliyunVodUpToYoPublishModel: aliyunVodUpToYoPublishModel, view: self?.navigationBarbgView)
             
         }
         
@@ -343,7 +334,7 @@ class CommunityViewController: BaseViewController {
     }
     
     /// navigationBar
-    private lazy var navigationBarbgView: UIView = {
+    lazy var navigationBarbgView: UIView = {
         let navigationBarbgView = UIView()
         navigationBarbgView.isHidden = true
         return navigationBarbgView

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -59,12 +59,17 @@ class CommunityVideoListController: BaseViewController {
         statusBarStyle = .lightContent
     }
     
+    override func viewWillAppear(_ animated: Bool) {
+        UIApplication.shared.isIdleTimerDisabled = true
+    }
+    
     override func viewDidAppear(_ animated: Bool) {
         playFirstVideoWhenViewDidAppeared()
     }
     
     override func viewWillDisappear(_ animated: Bool) {
         pauseCurrentVideo()
+        UIApplication.shared.isIdleTimerDisabled = false
     }
     
     func setUpAppStatusNotification() {

+ 9 - 5
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageList/ViewController/MessageListController.swift

@@ -91,11 +91,15 @@ extension MessageListController {
                 break
             case .follow?:
                 DIYEmptyView.emptyNoDataActionTableView(tableView: self?.tableView, imageStr: .seven, detailStr: .seven, btnTitleStr: .four, btnClickBlock: {
-                    let pickVc = PublishViewController()
-                    let nav = BaseNavigationViewController.init(rootViewController: pickVc)
-                    self?.tabBarController?.present(nav, animated: true, completion: {
-                        self?.navigationController?.popToRootViewController(animated: false)
-                    })
+                    if BaseTabbarViewController.shared.v1.navigationBarbgView.isHidden {
+                        let pickVc = PublishViewController()
+                        let nav = BaseNavigationViewController.init(rootViewController: pickVc)
+                        self?.tabBarController?.present(nav, animated: true, completion: {
+                            self?.navigationController?.popToRootViewController(animated: false)
+                        })
+                    } else {
+                        SwiftProgressHUD.shared().showText("内容上传中,请稍等", textAlignment: .center)
+                    }
                 })
                 break
             default:

+ 10 - 5
RainbowPlanet/RainbowPlanet/Modules/MineModule/MyFollowAndFan/ViewController/MyFollowAndFanViewController.swift

@@ -127,11 +127,16 @@ extension MyFollowAndFanViewController {
         SwiftMoyaNetWorkServiceUser.shared().userFansApi(uid: self.userDetailModel?.uid ?? 0, page: page,completion: {[weak self] (userFansModel) -> (Void) in
             DIYEmptyView.emptyNoDataActionTableView(tableView: self?.tableView, imageStr: .seven, detailStr: .seven, btnTitleStr: .four, btnClickBlock: {
                 [weak self] in
-                let pickVc = PublishViewController()
-                let nav = BaseNavigationViewController.init(rootViewController: pickVc)
-                self?.tabBarController?.present(nav, animated: true, completion: {
-                    self?.navigationController?.popToRootViewController(animated: false)
-                })
+                if BaseTabbarViewController.shared.v1.navigationBarbgView.isHidden {
+                    let pickVc = PublishViewController()
+                    let nav = BaseNavigationViewController.init(rootViewController: pickVc)
+                    self?.tabBarController?.present(nav, animated: true, completion: {
+                        self?.navigationController?.popToRootViewController(animated: false)
+                    })
+                } else {
+                    SwiftProgressHUD.shared().showText("内容上传中,请稍等", textAlignment: .center)
+                }
+                
             })
             let userFansModel = userFansModel as? UserFansModel
             if userFansModel?.pagination?.currentPage == 1{

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/ViewController/UserPersonalCenterViewController.swift

@@ -143,6 +143,11 @@ class UserPersonalCenterViewController: BaseViewController {
             [weak self] (notification) in
             self?.userMemberDetailApi()
         })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("PublishPostSuccess"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.userMemberDetailApi()
+        })
     }
     
     // 设置Badge

+ 5 - 5
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/PathManager/AliyunPathManager.m

@@ -13,11 +13,11 @@
 #pragma mark - Public
 
 + (NSString *)aliyunRootPath {
-    return [[self rootPath] stringByAppendingPathComponent:@"com.rainbow.project"];
+    return [[[self rootPath] stringByAppendingPathComponent:NSBundle.mainBundle.bundleIdentifier] stringByAppendingPathComponent:@".project"];
 }
 
 + (NSString *)quCachePath {
-    return [[self cachePath] stringByAppendingPathComponent:@"com.rainbow.project"];
+    return [[[self cachePath] stringByAppendingPathComponent:NSBundle.mainBundle.bundleIdentifier] stringByAppendingPathComponent:@".project"];
 }
 
 + (NSString *)compositionRootDir {
@@ -26,7 +26,7 @@
 
 + (NSString *)quRelativeRootPath {
     
-    return @"Documents/com.rainbow.project";
+    return @"Doucments/com.uptoyo.uptoyo.project";
 }
 
 //+ (NSString *)createCompositionDir {
@@ -59,11 +59,11 @@
 }
 
 + (NSString *)createResourceDir {
-    return [[self aliyunRootPath] stringByAppendingPathComponent:@"QPRes"];
+    return [[self aliyunRootPath] stringByAppendingPathComponent:@"Resource"];
 }
 
 + (NSString *)resourceRelativeDir {
-    return [[self quRelativeRootPath] stringByAppendingPathComponent:@"QPRes"];
+    return [[self quRelativeRootPath] stringByAppendingPathComponent:@"Resource"];
 }
 
 #pragma mark - Private

+ 30 - 7
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEdit/Controller/PublishEditController.swift

@@ -283,18 +283,42 @@ extension PublishEditController {
             SwiftProgressHUD.shared().showText("还没选择话题哟")
             return
         }
-        
-        PublishUploadManager.shared().setPublishParas(self.selTopicIdArr, self.pubTitle, self.pubContent, self.locationStr)
+        ///发布参数
+        let aliyunVodUpToYoPublishModel = AliyunVodUpToYoPublishModel()
+        aliyunVodUpToYoPublishModel.topicIds = self.selTopicIdArr
+        aliyunVodUpToYoPublishModel.title = self.pubTitle
+        aliyunVodUpToYoPublishModel.content = self.pubContent
+        aliyunVodUpToYoPublishModel.locationString = self.locationStr
         
         if self.mediaType == .video {
-            PublishUploadManager.shared().setVideoPath(self.mediaType, self.videoPath, self.coverImagePath, self.videoImage!)
+            aliyunVodUpToYoPublishModel.publishType = .video
+            aliyunVodUpToYoPublishModel.videoCoverImage = videoImage
+            aliyunVodUpToYoPublishModel.videoCoverImageUrlPath = coverImagePath
+            aliyunVodUpToYoPublishModel.videoPath = self.videoPath
         }
         if self.mediaType == .image {
-            self.writePhotosToFileAndSetPath()
+            aliyunVodUpToYoPublishModel.publishType = .image
+            aliyunVodUpToYoPublishModel.images = self.imageArr
         }
-        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "DismissFromPublishEditVc"), object: self.mediaType)
+        
+        
+        
+        
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "DismissFromPublishEditVc"), object: aliyunVodUpToYoPublishModel)
         BaseTabbarViewController.shared.esTabBarController.selectedIndex = 0
         self.dismissToWindowRootViewController(animated: false, completion: nil)
+//
+//
+//
+//        PublishUploadManager.shared().setPublishParas(self.selTopicIdArr, self.pubTitle, self.pubContent, self.locationStr)
+//
+//        if self.mediaType == .video {
+//            PublishUploadManager.shared().setVideoPath(self.mediaType, self.videoPath, self.coverImagePath, self.videoImage!)
+//        }
+//        if self.mediaType == .image {
+//            self.writePhotosToFileAndSetPath()
+//        }
+
 
     }
     
@@ -312,11 +336,10 @@ extension PublishEditController {
             catch {
                 print("存入失败")
             }
-            
             self.imageAssetUrl.append(imagePath)
         }
         
-        PublishUploadManager.shared().setImagesPath(self.imageArr!, self.imageAssetUrl)
+//        PublishUploadManager.shared().setImagesPath(self.imageArr!, self.imageAssetUrl)
     }
     
     // 改变发布按钮颜色

+ 0 - 299
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishManager/PublishUploadManager.swift

@@ -1,299 +0,0 @@
-//
-//  PublishUploadManager.swift
-//  RainbowPlanet
-//
-//  Created by Christopher on 2019/7/21.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-import SwiftyJSON
-
-class PublishUploadManager: NSObject {
-    
-    private static let _sharedInstance = PublishUploadManager()
-    
-    private override init() {} // 私有化init方法
-    
-    class func shared() -> PublishUploadManager {
-        return _sharedInstance
-    }
-    
-    // 视频上传参数
-    var mediaType: PublishMediaType = .image
-    var videoPath: String = ""
-    var coverImagePath: String = ""
-    var videoImage: UIImage?  {
-        didSet {
-            imageArr = [videoImage] as? Array<UIImage>
-        }
-    }
-    
-    // 图片上传参数
-    var imageArr: Array<UIImage>?
-    var imageAssetUrlArr: Array<String>?
-    
-    // 发布参数
-    var selTopicIdArr: Array<String> = []
-    var pubTitle: String = ""
-    var pubContent: String = ""
-    var locationStr: String = ""
-    
-    // 视频id,当type为video时必填
-    var paraVideo: String = ""
-    // 主图Url
-    var majorImageUrl: String?
-    // 发布图片のUrlArray
-    var imageUrlArray: Array<String> = []
-    
-    // 记录当前是否发布完成
-    var isPublishFinished: Bool = true
-    // 图片上传时当前循环次数
-    var curTimes: Int = 0
-    // 是否正在上传视频封面
-    var isUploadingVideoCover: Bool = false
-    
-    var uploadManager: AlivcShortVideoUploadManager?
-    
-    var progressView: PublishUploadProgressView?
-}
-
-
-// MARK: - 视频上传流程
-extension PublishUploadManager {
-    
-    // 设置视频上传参数
-    func setVideoPath(_ mediaType: PublishMediaType, _ videoPath: String, _ coverImagePath: String, _ videoImage: UIImage) {
-        self.mediaType = mediaType
-        self.videoPath = videoPath
-        self.coverImagePath = coverImagePath
-        self.videoImage = videoImage
-        // 新发布时还原管理类内部的变量
-        self.isUploadingVideoCover = false
-    }
-    
-    // 获取上传地址和凭证(视频)
-    func communityVideoUploadAuthApi() {
-        isPublishFinished = false
-
-        var vTitle: String = ""
-        if videoPath.count > 20 {
-            vTitle = String(videoPath.suffix(20))
-        } else {
-            vTitle = videoPath
-        }
-        SwiftMoyaNetWorkServiceCommunity.shared().communityVideoUploadAuthApi(title: vTitle, filename: vTitle, cover_url: coverImagePath) {
-            [weak self] (communityVideoAuthModel) -> (Void) in
-            let communityVideoAuthModel = communityVideoAuthModel as? CommunityVideoAuthModel
-            self?.paraVideo = communityVideoAuthModel?.videoId ?? ""
-            self?.startUploadVideo(communityVideoAuthModel!)
-        }
-    }
-    
-    // 上传视频
-    func startUploadVideo(_ authModel: CommunityVideoAuthModel) {
-        let info = AliyunUploadSVideoInfo()
-        uploadManager = AlivcShortVideoUploadManager.shared()
-        uploadManager?.setCoverImagePath(coverImagePath, videoInfo: info, videoPath: videoPath)
-        uploadManager?.managerDelegate = self
-        uploadManager?.uploadAddress = authModel.uploadAddress
-        uploadManager?.videoId = authModel.videoId
-        uploadManager?.uploadAuth = authModel.uploadAuth
-        uploadManager?.startUpload()
-    }
-    
-    // 获取上传地址和凭证(图片)
-    func videoCoverImageUploadAuth() {
-        SwiftMoyaNetWorkServiceCommunity.shared().communityImageUploadAuth {
-            [weak self] (communityImageAuthModel) -> (Void) in
-            let communityImageAuthModel = communityImageAuthModel as? CommunityImageAuthModel
-            
-            let imgWidth  = Int(self?.videoImage!.size.width ?? 0)
-            let imgHeight = Int(self?.videoImage!.size.height ?? 0)
-            let urlStr = String(format: "%@?%ld_%ld", communityImageAuthModel?.imageURL ?? "", imgWidth, imgHeight)
-            // 设置主图
-            self?.majorImageUrl = urlStr
-            
-            self?.uploadVideoCoverImage(communityImageAuthModel!)
-        }
-    }
-    
-    // 上传视频封面图
-    func uploadVideoCoverImage(_ authModel: CommunityImageAuthModel) {
-        self.isUploadingVideoCover = true
-        
-        uploadManager = AlivcShortVideoUploadManager.shared()
-        uploadManager?.setCoverImagePath(coverImagePath, videoInfo: nil, videoPath: "")
-        uploadManager?.managerDelegate = self
-        uploadManager?.uploadAddress = authModel.uploadAddress
-        uploadManager?.uploadAuth = authModel.uploadAuth
-        uploadManager?.startUpload()
-    }
-    
-}
-
-
-// MARK: - 图片上传流程
-extension PublishUploadManager {
-    
-    // 设置图片上传参数
-    func setImagesPath(_ imageArr: Array<UIImage>, _ imageUrlArr: Array<String>) {
-        self.imageArr = imageArr
-        self.imageAssetUrlArr = imageUrlArr
-        // 新发布时置空管理类内部的imageUrl数组及循环次数
-        self.imageUrlArray = []
-        self.curTimes = 0
-    }
-    
-    // 获取上传地址和凭证(图片)
-    func communityImageUploadAuth(totalTimes: Int) {
-        isPublishFinished = false
-        
-        SwiftMoyaNetWorkServiceCommunity.shared().communityImageUploadAuth {
-            [weak self] (communityImageAuthModel) -> (Void) in
-            let communityImageAuthModel = communityImageAuthModel as? CommunityImageAuthModel
-            
-            let curImage: UIImage = self?.imageArr![totalTimes] ?? UIImage()
-            let imgWidth  = Int(curImage.size.width)
-            let imgHeight = Int(curImage.size.height)
-            let urlStr = String(format: "%@?%ld_%ld", communityImageAuthModel?.imageURL ?? "", imgWidth, imgHeight)
-            self?.imageUrlArray.append(urlStr)
-            
-            self?.startUploadImage(communityImageAuthModel!, totalTimes)
-        }
-    }
-    
-    // 上传图片
-    func startUploadImage(_ authModel: CommunityImageAuthModel, _ totalTimes: Int) {
-        self.curTimes = totalTimes
-        
-        uploadManager = AlivcShortVideoUploadManager.shared()
-        uploadManager?.setCoverImagePath(self.imageAssetUrlArr?[totalTimes], videoInfo: nil, videoPath: "")
-        uploadManager?.managerDelegate = self
-        uploadManager?.uploadAddress = authModel.uploadAddress
-        uploadManager?.uploadAuth = authModel.uploadAuth
-        uploadManager?.startUpload()
-    }
-    
-}
-
-// MARK: - 上传过程监听
-extension PublishUploadManager: AlivcShortVideoUploadManagerDelegate {
-    
-    // 上传进度回调
-    func uploadManager(_ manager: AlivcShortVideoUploadManager!, updateProgress progress: CGFloat) {
-        NXLLog("-------------------上传进度回调 - progress == \(progress)")
-        DispatchQueue.main.async(execute: {
-            if self.mediaType == .image {
-                NXLLog("\n--------\(self.curTimes) uploadProgress == \(progress)")
-            } else {
-                self.progressView?.uploadProgress = Float(progress)
-            }
-        })
-    }
-    
-    // 上传状态回调
-    func uploadManager(_ manager: AlivcShortVideoUploadManager!, uploadStatusChangedTo newStatus: AlivcUploadStatus) {
-        switch newStatus {
-        case AlivcUploadStatus.failure:
-            DispatchQueue.main.async(execute: {
-                SwiftProgressHUD.shared().showText("上传失败!")
-                self.isPublishFinished = true
-                self.progressView?.curUploadStatus = .failure
-            })
-            
-        case AlivcUploadStatus.success:
-            DispatchQueue.main.async(execute: {
-                if self.mediaType == .image {
-                    // 图片上传流程
-                    self.curTimes += 1
-                    
-                    // 更新进度
-                    NXLLog("----uploadProgress == \(Float(self.curTimes)/Float(self.imageArr!.count))")
-                    self.progressView?.uploadProgress = Float(self.curTimes/self.imageArr!.count)
-                    
-                    if self.curTimes < self.imageArr?.count ?? 0 {
-                        // 继续上传
-                        self.communityImageUploadAuth(totalTimes: self.curTimes)
-                    } else {
-                        // 图片上传成功,去发布
-                        // 设置主图
-                        self.majorImageUrl = self.imageUrlArray[0]
-                        self.progressView?.curUploadStatus = .success
-                        self.communityPublishApi()
-                    }
-                    
-                } else {
-                    // 视频上传流程
-                    if self.isUploadingVideoCover {
-                        // 上传封面图の返回
-                        self.isUploadingVideoCover = false
-                        
-                        // 视频上传成功,去发布
-                        self.progressView?.curUploadStatus = .success
-                        self.communityPublishApi()
-                        
-                    } else {
-                        // 上传视频の返回
-                        self.videoCoverImageUploadAuth()
-                    }
-                }
-            })
-            
-        default:
-            break
-        }
-    }
-}
-
-
-// MARK: - 发布流程
-extension PublishUploadManager {
-    
-    // 设置发布上传参数
-    func setPublishParas(_ selTopicIdArr: Array<String>, _ pubTitle: String, _ pubContent: String, _ locationStr: String) {
-        self.selTopicIdArr = selTopicIdArr
-        self.pubTitle = pubTitle
-        self.pubContent = pubContent
-        self.locationStr = locationStr
-    }
-    
-    // 发布Api
-    private func communityPublishApi() {
-        
-        var typeStr: String = ""
-        if mediaType == .image {
-            typeStr = "image"
-        } else {
-            typeStr = "video"
-        }
-        
-        let topicJsonStr = JSON(selTopicIdArr).description
-        let imgsJsonStr = JSON(imageUrlArray).description
-        
-        NXLLog("----mediaType == \(typeStr)\n----pubTitle = \(pubTitle)\n----topicJsonStr == \(topicJsonStr)\n----imgsJsonStr == \(imgsJsonStr)")
-        
-        SwiftMoyaNetWorkServiceCommunity.shared().communityPublishApi(type: typeStr, img: majorImageUrl ?? "", topic_ids: topicJsonStr, video: paraVideo, title: pubTitle, content: pubContent, location: locationStr, imgs: imgsJsonStr) {
-            [weak self] (communityPublishModel) -> (Void) in
-            let communityPublishModel = communityPublishModel as? CommunityPublishModel
-            self?.publishSuccessAction(communityPublishModel!)
-        }
-    }
-    
-    private func publishSuccessAction(_ pubModel: CommunityPublishModel) {
-        var typeStr: String = ""
-        if mediaType == .image {
-            typeStr = "image"
-        } else {
-            typeStr = "video"
-        }
-        
-        VirusViewModel.shared.publishVirueRecordAddApi(postId: pubModel.postId, postType: typeStr, title: pubTitle, content: pubContent, postCover: majorImageUrl)
-        // 发布成功
-        isPublishFinished = true
-        progressView?.hide()
-        progressView?.attachedView?.isHidden = true
-        
-//        progressView?.curUploadStatus = UploadStatus.failure
-    }
-}

+ 2 - 3
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/ViewController/SearchContentListViewController.swift

@@ -88,9 +88,8 @@ extension SearchContentListViewController {
             [weak self] (communityPostsModel) -> (Void) in
             
             DIYEmptyView.emptyNoDataActionCollectionView(collectionView: self?.collectionView, imageStr: .six, detailStr: .six, btnTitleStr: .three, btnClickBlock: {
-                let pickVc = PublishViewController()
-                let nav = BaseNavigationViewController.init(rootViewController: pickVc)
-                BaseTabbarViewController.shared.esTabBarController.present(nav, animated: true, completion: nil)
+                BaseTabbarViewController.shared.pushPublishVC()
+
             })
             
             let communityPostsModel = communityPostsModel as? CommunityPostsModel

+ 6 - 3
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift

@@ -133,7 +133,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - imgs: 图集,type为image是必填,json字符串
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPublishApi(type:String = "", img:String = "", topic_ids:String = "", video:String = "", title:String = "", content:String = "", location:String = "", imgs:String = "", completion: @escaping successCallBack) {
+    func communityPublishApi(type:String = "", img:String = "", topic_ids:String = "", video:String = "", title:String = "", content:String = "", location:String = "", imgs:String = "", completion: @escaping successCallBack,fail:@escaping failCallback) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(type, forKey: "type")
         parameters.updateValue(img, forKey: "img")
@@ -149,6 +149,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
             completion(CommunityPublishModel)
         }) {
             (loadingStatus) in
+            fail(loadingStatus)
         }
     }
     
@@ -185,7 +186,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - filename: 视频名称(必须带扩展名)
     ///   - cover_url: 封面图,自定义视频封面URL地址
     ///   - completion: 回调
-    func communityVideoUploadAuthApi(title:String = "", filename:String = "", cover_url:String = "", completion: @escaping successCallBack) {
+    func communityVideoUploadAuthApi(title:String = "", filename:String = "", cover_url:String = "", completion: @escaping successCallBack,fail:@escaping failCallback) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(title, forKey: "title")
         parameters.updateValue(filename, forKey: "filename")
@@ -196,6 +197,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
             completion(communityVideoAuthModel)
         }) {
             (loadingStatus) in
+            fail(loadingStatus)
         }
     }
     
@@ -203,7 +205,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func communityImageUploadAuth(completion: @escaping successCallBack) {
+    func communityImageUploadAuth(completion: @escaping successCallBack,fail:@escaping failCallback) {
         let parameters = Dictionary<String,Any>()
         
         
@@ -212,6 +214,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
             completion(CommunityImageAuthModel)
         }) {
             (loadingStatus) in
+            fail(loadingStatus)
         }
     }
     

+ 1 - 0
RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

@@ -854,6 +854,7 @@ extension VirusViewModel {
         virueRecordAddParameterModel.postCover = postCover
         
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
+            
         })
     }
 }