Ver código fonte

关注完成

南鑫林 5 anos atrás
pai
commit
e2a7cf9c31
13 arquivos alterados com 275 adições e 45 exclusões
  1. 12 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 33 1
      RainbowPlanet/RainbowPlanet/Manager/WebViewJavascriptBridgeManager/WebViewJavascriptBridgeManager.swift
  3. 2 2
      RainbowPlanet/RainbowPlanet/Model/UserModel/FollowStatusModel.swift
  4. 63 7
      RainbowPlanet/RainbowPlanet/Model/WVJBModel/WVJBModel.swift
  5. 31 6
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  6. 1 25
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift
  7. 14 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Planet/CommunityPlanet/CommunityPlanetViewController.swift
  8. 20 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  9. 19 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  10. 18 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/ViewController/CommunityFindFriendsViewController.swift
  11. 18 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift
  12. 36 0
      RainbowPlanet/RainbowPlanet/Router/H5RouterModuleType.swift
  13. 8 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

+ 12 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -382,6 +382,7 @@
 		A7D5F26122C0C2F300F8E9AF /* UserFollowsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D5F26022C0C2F300F8E9AF /* UserFollowsModel.swift */; };
 		A7D5F26322C0CF8600F8E9AF /* UserFansModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D5F26222C0CF8600F8E9AF /* UserFansModel.swift */; };
 		A7D5F26522C118F100F8E9AF /* CMSMemberListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D5F26422C118F100F8E9AF /* CMSMemberListModel.swift */; };
+		A7DAB33322D881F5005B964E /* H5RouterModuleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DAB33222D881F5005B964E /* H5RouterModuleType.swift */; };
 		A7DC467F22783A47001F3EFC /* EditExpressAddressTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DC467E22783A47001F3EFC /* EditExpressAddressTableViewCell.swift */; };
 		A7DF50D622A4E8B400998908 /* OrderDetailProductTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF50D522A4E8B400998908 /* OrderDetailProductTableViewCell.swift */; };
 		A7DF50D822A4FAFC00998908 /* ProductDetailEvaluationImageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7DF50D722A4FAFC00998908 /* ProductDetailEvaluationImageCollectionViewCell.swift */; };
@@ -1071,6 +1072,7 @@
 		A7D5F26022C0C2F300F8E9AF /* UserFollowsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserFollowsModel.swift; sourceTree = "<group>"; };
 		A7D5F26222C0CF8600F8E9AF /* UserFansModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserFansModel.swift; sourceTree = "<group>"; };
 		A7D5F26422C118F100F8E9AF /* CMSMemberListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSMemberListModel.swift; sourceTree = "<group>"; };
+		A7DAB33222D881F5005B964E /* H5RouterModuleType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = H5RouterModuleType.swift; sourceTree = "<group>"; };
 		A7DC467E22783A47001F3EFC /* EditExpressAddressTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditExpressAddressTableViewCell.swift; sourceTree = "<group>"; };
 		A7DF50D522A4E8B400998908 /* OrderDetailProductTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderDetailProductTableViewCell.swift; sourceTree = "<group>"; };
 		A7DF50D722A4FAFC00998908 /* ProductDetailEvaluationImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductDetailEvaluationImageCollectionViewCell.swift; sourceTree = "<group>"; };
@@ -1820,6 +1822,7 @@
 				BD2FCBDE22B21BE00006D974 /* CommunityRecommendDetail */,
 				A7C0FDFC22B66B3C00BC1E86 /* CommunityFeaturedTopics */,
 				BD1FC17D22B08CEB00D55081 /* CommunityMyFollowTopic */,
+				A7DAB33122D875C0005B964E /* CommunityVideoSubCommentController */,
 				BD27F0AA22CC5E0400A6514D /* CommunityVideoContent */,
 			);
 			path = CommunityModule;
@@ -3450,6 +3453,7 @@
 			children = (
 				A770E5DA22CED8C600CBD0A4 /* RouterManager.swift */,
 				A770E5DF22CF19FA00CBD0A4 /* CommunityRouterModuleType.swift */,
+				A7DAB33222D881F5005B964E /* H5RouterModuleType.swift */,
 			);
 			path = Router;
 			sourceTree = "<group>";
@@ -4035,6 +4039,13 @@
 			path = CommunityModel;
 			sourceTree = "<group>";
 		};
+		A7DAB33122D875C0005B964E /* CommunityVideoSubCommentController */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = CommunityVideoSubCommentController;
+			sourceTree = "<group>";
+		};
 		A7DF50D922A556C300998908 /* BrowsePictures */ = {
 			isa = PBXGroup;
 			children = (
@@ -6222,6 +6233,7 @@
 				BDF862AE228E57E1000DEF84 /* OrderCommentDefaultCollectionCell.swift in Sources */,
 				BD61229722C3605C00D3F513 /* AliyunEffectPrestoreManager.m in Sources */,
 				A70B2C3E228825B100B2449F /* ProductDetailEvaluationTableViewCell.swift in Sources */,
+				A7DAB33322D881F5005B964E /* H5RouterModuleType.swift in Sources */,
 				A79057022276C9770037F823 /* SetPasswordModel.swift in Sources */,
 				BD12B68022B4EF2600AEB10B /* KSMediaPickerViewImageCell.swift in Sources */,
 				A7274C5A228EE636000E3A07 /* LBXScanView.swift in Sources */,

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

@@ -9,6 +9,7 @@
 import UIKit
 import WebViewJavascriptBridge
 import SwiftyJSON
+import SwiftyMediator
 
 class WebViewJavascriptBridgeManager: NSObject {
     
@@ -20,7 +21,7 @@ class WebViewJavascriptBridgeManager: NSObject {
     ///
     /// - Parameter bridge: 交互对象
     func callHandlerH5(bridge: WebViewJavascriptBridge?) {
-        bridge?.callHandler("h5", data:  UserModel.shared().getH5UserInfo())
+        bridge?.callHandler("h5", data: UserModel.shared().getH5UserInfo())
     }
     
     
@@ -39,4 +40,35 @@ class WebViewJavascriptBridgeManager: NSObject {
             responseCallback!(nil)
         })
     }
+    
+    func notification(notification:Notification,viewController:UIViewController? = nil) {
+        let wvjbModel = notification.object as? WVJBModel
+        // 链接
+        if wvjbModel?.modelType == .link {
+            Mediator.push(H5RouterModuleType.pushWeb(URLString: wvjbModel!.params!.url!))
+        }
+        // 复制邀请码
+        if wvjbModel?.modelType  == .copy {
+            commonCopy(string: wvjbModel!.params!.content!)
+        }
+        // 跳转原生
+        if wvjbModel?.modelType  == .view {
+            // 发布
+            if wvjbModel?.params?.paramsModelPage == .publist {
+                Mediator.present(H5RouterModuleType.presentPublish)
+            }
+            // 推荐
+            if wvjbModel?.params?.paramsModelPage == .join {
+                let viewController = viewController as? CommunityViewController
+                viewController?.reloadSegmentedView()
+            }
+        }
+        // 跳转原生
+        if wvjbModel?.modelType  == .follow {
+            let followStatusModel = FollowStatusModel()
+            followStatusModel.uid = wvjbModel!.params?.uid ?? 0
+            followStatusModel.isFollowStatus = wvjbModel!.params?.status ?? 0
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "followApi"), object: followStatusModel, userInfo: ["isPlanet":true])
+        }
+    }
 }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Model/UserModel/FollowStatusModel.swift

@@ -9,13 +9,13 @@ import ObjectMapper
 class FollowStatusModel : NSObject, Mappable{
 
 	var isFollowStatus : Int?
-
+    var uid : Int?
 
 	class func newInstance(map: Map) -> Mappable?{
 		return FollowStatusModel()
 	}
 	required init?(map: Map){}
-	private override init(){}
+    override init(){}
 
 	func mapping(map: Map)
 	{

+ 63 - 7
RainbowPlanet/RainbowPlanet/Model/WVJBModel/WVJBModel.swift

@@ -7,18 +7,33 @@ import ObjectMapper
 
 /// h5交互的类型
 ///
+/// - none: 没有
 /// - share: 分享
-/// - view: 跳转原生
+/// - view: APP原生页面跳转
+/// - link: H5页面跳转
+/// - copy: 复制
+/// - bean: 刷新彩虹豆
+/// - preview: 预览图片
+/// - follow: 关注
 enum WVJBModelType : String {
+    case none = ""
     case share = "share"
     case view = "view"
     case link = "link"
     case copy = "copy"
+    case bean = "bean"
+    case preview = "preview"
+    case follow = "follow"
 }
 /// WebViewJavascriptBridgeModel 简写 WVJBModel
 class WVJBModel:NSObject,Mappable{
 
-    var type : String?
+    var modelType : WVJBModelType?
+    var type : String? {
+        didSet {
+           modelType = WVJBModelType(rawValue: type ?? "") ?? .none
+        }
+    }
     var params : WVJBParamsModel?
 
 	class func newInstance(map: Map) -> Mappable?{
@@ -34,31 +49,68 @@ class WVJBModel:NSObject,Mappable{
     }
 
 }
+
+/// 邀请
+///
+/// - none: 没有
+/// - invite: 分享
 enum WVJBParamsModelType : String {
+    case none = ""
     case invite = "invite"
 }
 
-/// 交互类型参数
+/// APP原生页面跳转类型
 ///
+/// - none: 没有
 /// - publist: 发布
-/// - join: 参与
+/// - join: feed流
+/// - account: 账户(绑定微信)
+/// - exchange: 兑换商城
+/// - planet: 星球
 enum WVJBParamsModelPage : String {
+    case none = ""
     case publist = "publish"
     case join = "join"
+    case account = "account"
+    case exchange = "exchange"
+    case planet = "planet"
 }
 /// WebViewJavascriptBridgeParameterModel 简写 WVJBParameterModel
 class WVJBParamsModel:NSObject,Mappable {
 
-    var type : String?
-    var page :String?
+
     var url : String?
+    //复制内容
     var content : String?
+    /// 关注
+    var uid : Int?
+    /// 关注状态
+    var status : Int?
+    /// 预览图片 数组
+    var list : [String]?
+    /// 初始位置
+    var current : Int?
+    /// 交互类型参数
+    var paramsModelType : WVJBParamsModelType?
+    var type : String? {
+        didSet {
+            paramsModelType = WVJBParamsModelType(rawValue: type ?? "") ?? .none
+            
+        }
+    }
+    //APP原生页面跳转类型
+    var paramsModelPage : WVJBParamsModelPage?
+    var page :String? {
+        didSet {
+            paramsModelPage = WVJBParamsModelPage(rawValue: page ?? "") ?? .none
+        }
+    }
     
     class func newInstance(map: Map) -> Mappable?{
         return WVJBParamsModel()
     }
     required init?(map: Map){}
-    private override init(){}
+    override init(){}
     
     func mapping(map: Map)
     {
@@ -66,6 +118,10 @@ class WVJBParamsModel:NSObject,Mappable {
         page <- map["page"]
         url <- map["url"]
         content <- map["content"]
+        uid <- map["uid"]
+        status <- map["status"]
+        list <- map["current"]
+        current <- map["current"]
     }
 
 }

+ 31 - 6
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -11,12 +11,6 @@ import JXSegmentedView
 
 class CommunityFollowViewController: UIViewController {
     
-    var cellHeightsDictionary = Dictionary<IndexPath, Any>()
-    var communityFollowDataModels = Array<CommunityFollowDataModel>()
-    var communityFollowDataModel : CommunityFollowDataModel?
-    var keyBoardCommentView : KeyBoardCommentView?
-    /// 关注数组
-    var cmsMemberModels = Array<CMSMemberModel>()
     deinit {
         if observe != nil {
             NotificationCenter.default.removeObserver(observe!)
@@ -24,6 +18,13 @@ class CommunityFollowViewController: UIViewController {
     }
     weak var observe : NSObjectProtocol?
     
+    var cellHeightsDictionary = Dictionary<IndexPath, Any>()
+    var communityFollowDataModels = Array<CommunityFollowDataModel>()
+    var communityFollowDataModel : CommunityFollowDataModel?
+    var keyBoardCommentView : KeyBoardCommentView?
+    /// 关注数组
+    var cmsMemberModels = Array<CMSMemberModel>()
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -68,6 +69,30 @@ class CommunityFollowViewController: UIViewController {
             SwiftProgressHUD.shared().showWait()
             self?.communityFollowFeedApi(page: page)
         }
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let followStatusModel = notification.object as? FollowStatusModel
+            
+            if !(self?.cmsMemberModels.isEmpty ?? true) {
+                for cmsMemberModel in (self?.cmsMemberModels)! {
+                    if cmsMemberModel.uid == followStatusModel?.uid {
+                        cmsMemberModel.followStatus = followStatusModel?.isFollowStatus
+                    }
+                }
+            }
+            
+            if !(self?.communityFollowDataModels.isEmpty ?? true) {
+                for communityFollowDataModel in (self?.communityFollowDataModels)! {
+                    if communityFollowDataModel.relateData?.uid == followStatusModel?.uid {
+                        communityFollowDataModel.relateData?.isFollow = followStatusModel?.isFollowStatus
+                    }
+                }
+            }
+            
+            self?.tableView.reloadData()
+
+
+        }
 
     }
     

+ 1 - 25
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift

@@ -224,31 +224,7 @@ class CommunityViewController: BaseViewController {
         
         // 星球H5
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityPlanetH5"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
-            let wvjbModel = notification.object as? WVJBModel
-            // 链接
-            if WVJBModelType(rawValue: wvjbModel!.type!)  == .link {
-                 let vc = H5CommonViewController()
-                let URLString = wvjbModel!.params!.url!
-                vc.URLString = URLString
-                self?.navigationController?.pushViewController(vc, animated: true)
-            }
-            // 复制邀请码
-            if WVJBModelType(rawValue: wvjbModel!.type!)  == .copy {
-                commonCopy(string: wvjbModel!.params!.content!)
-            }
-            // 跳转原生
-            if WVJBModelType(rawValue: wvjbModel!.type!)  == .view {
-                // 发布
-                if WVJBParamsModelPage(rawValue: wvjbModel!.params!.page ?? "") == .publist {
-                    let vc = PublishViewController()
-                    self?.present(vc, animated: true, completion: nil)
-                }
-                
-                // 去参与
-                if WVJBParamsModelPage(rawValue: wvjbModel!.params!.page ?? "") == .join {
-                    self?.reloadSegmentedView()
-                }
-            }
+            WebViewJavascriptBridgeManager.shared.notification(notification: notification,viewController: self)
         }
     }
     

+ 14 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Planet/CommunityPlanet/CommunityPlanetViewController.swift

@@ -15,6 +15,13 @@ import MJRefresh
 
 class CommunityPlanetViewController: BaseJSWebViewController {
     
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         self.URLString = kH5PlanetUrl
@@ -35,14 +42,19 @@ class CommunityPlanetViewController: BaseJSWebViewController {
     }
     override func setupData() {
         super.setupData()
-        
 
-        self.wkWebView.scrollView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
+        wkWebView.scrollView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
             WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
         }
         WebViewJavascriptBridgeManager.shared.registerHandlerApp(bridge: bridge) { (wvjbModel) in
             NotificationCenter.default.post(name: NSNotification.Name("CommunityPlanetH5"), object: wvjbModel)
         }
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            if notification.userInfo == nil {
+                WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
+            }
+        }
+        
     }
 }
 

+ 20 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift

@@ -11,6 +11,13 @@ import JXSegmentedView
 
 class CommunityRecommnendViewController: UIViewController {
     
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
+    
     var cellHeightsDictionary = Dictionary<IndexPath, Any>()
     var communityRecommendDataModels = Array<CommunityRecommendDataModel>()
     /// 评论需要的模型
@@ -50,6 +57,19 @@ class CommunityRecommnendViewController: UIViewController {
             [weak self] (page) in
             self?.communityPostSuggestApi(page:page)
         }
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let followStatusModel = notification.object as? FollowStatusModel
+            if !(self?.communityRecommendDataModels.isEmpty ?? true) {
+                for communityRecommendDataModel in (self?.communityRecommendDataModels)! {
+                    if communityRecommendDataModel.uid == followStatusModel?.uid {
+                        communityRecommendDataModel.isFollow = followStatusModel?.isFollowStatus
+                    }
+                }
+            }
+            self?.tableView.reloadData()
+        }
+        
+        
     }
     
     private lazy var tableView: UITableView = {

+ 19 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -10,6 +10,13 @@ import UIKit
 
 class CommunityFeaturedTopicsViewController: BaseViewController {
     
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
+    
     var cellHeightsDictionary = Dictionary<IndexPath, Any>()
     var id : Int = 0
     var communityRecommendDataModels = Array<CommunityRecommendDataModel>()
@@ -181,6 +188,18 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
             let vc = CommunityMyFollowTopicController()
             self?.navigationController?.pushViewController(vc, animated: true)
         }
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let followStatusModel = notification.object as? FollowStatusModel
+            if !(self?.communityRecommendDataModels.isEmpty ?? true) {
+                for communityRecommendDataModel in (self?.communityRecommendDataModels)! {
+                    if communityRecommendDataModel.uid == followStatusModel?.uid {
+                        communityRecommendDataModel.isFollow = followStatusModel?.isFollowStatus
+                    }
+                }
+            }
+            self?.tableView.reloadData()
+        }
     }
     
     /// 显示键盘

+ 18 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/ViewController/CommunityFindFriendsViewController.swift

@@ -10,6 +10,13 @@ import UIKit
 
 class CommunityFindFriendsViewController: BaseViewController {
     
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
+    
     /// 关注数组
     var cmsMemberModels = Array<CMSMemberModel>()
     
@@ -48,6 +55,17 @@ class CommunityFindFriendsViewController: BaseViewController {
         tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
             self?.cmsMemberListApi()
         }
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let followStatusModel = notification.object as? FollowStatusModel
+            
+            if !(self?.cmsMemberModels.isEmpty ?? true) {
+                for cmsMemberModel in (self?.cmsMemberModels)! {
+                    if cmsMemberModel.uid == followStatusModel?.uid {
+                        cmsMemberModel.followStatus = followStatusModel?.isFollowStatus
+                    }
+                }
+            }
+        }
     }
     
     private lazy var tableView: UITableView = {

+ 18 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -9,6 +9,13 @@
 import UIKit
 
 class CommunityRecommendController: BaseViewController {
+    
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
 
     // 帖子Id
     var id : Int = 0
@@ -196,6 +203,17 @@ class CommunityRecommendController: BaseViewController {
                 VirusViewModel.shared.virueRecordAddApiCollection(communityPostDetailModel: self?.communityPostDetailModel,commentView: (self?.commentView)!)
             }
         }
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let followStatusModel = notification.object as? FollowStatusModel
+            
+            if self?.communityPostDetailModel?.uid == followStatusModel?.uid {
+                self?.communityPostDetailModel?.isFollow = followStatusModel?.isFollowStatus
+                self?.communityPostDetailTableViewHeaderView.communityPostDetailModel = self?.communityPostDetailModel
+                CommunityFollowUserViewModel.shared.setFollowType(followButton: (self?.followButton)!, followType: FollowType(rawValue: self?.communityPostDetailModel?.isFollow ?? 0) ?? .futureFollow)
+                self?.tableView.reloadData()
+            }
+        }
     }
     
     /// 显示键盘

+ 36 - 0
RainbowPlanet/RainbowPlanet/Router/H5RouterModuleType.swift

@@ -0,0 +1,36 @@
+//
+//  H5RouterModuleType.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/12.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import SwiftyMediator
+
+/// H5RouterModuleType
+
+
+/// <#Description#>
+///
+/// - pushWeb: 公共的h5
+/// - publish: 发布页面
+public enum H5RouterModuleType: MediatorTargetType {
+    case pushWeb(URLString: String)
+    case presentPublish
+}
+
+extension H5RouterModuleType: MediatorSourceType {
+    public var viewController: UIViewController? {
+        switch self {
+        case .pushWeb(let URLString):
+            let vc = H5CommonViewController()
+            vc.URLString = URLString
+            return vc
+        case .presentPublish:
+            let vc = PublishViewController()
+            return vc
+        }
+    }
+}

+ 8 - 2
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

@@ -630,8 +630,11 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         parameters.updateValue(followUid, forKey: "follow_uid")
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared.requestObject(FollowStatusModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userFollow(parameters: parameters))) { (followStatusModel) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            followStatusModel?.uid = followUid
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "followApi"), object: followStatusModel)
             SwiftProgressHUD.shared().showText("已关注")
-            completion(followStatusModel)
+            completion(followStatusModel as Any)
         }
     }
     
@@ -647,8 +650,11 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         parameters.updateValue(followUid, forKey: "follow_uid")
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared.requestObject(FollowStatusModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userCancelFollow(parameters: parameters))) { (followStatusModel) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            followStatusModel?.uid = followUid
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "followApi"), object: followStatusModel)
             SwiftProgressHUD.shared().showText("已取消关注")
-            completion(followStatusModel)
+            completion(followStatusModel as Any)
         }
     }