Browse Source

no message

南鑫林 5 years ago
parent
commit
21d2d98221
19 changed files with 138 additions and 58 deletions
  1. 12 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 3 0
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift
  3. 0 16
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate.swift
  4. 25 5
      RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift
  5. 24 0
      RainbowPlanet/RainbowPlanet/Manager/MessageModuleManager/MessageModuleManager.swift
  6. 16 1
      RainbowPlanet/RainbowPlanet/Model/UserModel/MessageIndexModel.swift
  7. 8 8
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/TitleContent/CardContentTitleTableViewCell.swift
  8. 9 13
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/CommunityNavigationBarView.swift
  9. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  10. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  11. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  12. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift
  13. 7 3
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageMain/ViewController/MessageMainViewController.swift
  14. 9 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListCollectionViewCell.swift
  15. 1 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListView.swift
  16. 1 1
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/ViewController/SearchContentListViewController.swift
  17. 1 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift
  18. 1 3
      RainbowPlanet/RainbowPlanet/ViewModel/UserMemberTotalBeanViewModel/UserMemberTotalBeanViewModel.swift
  19. 13 0
      RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

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

@@ -434,6 +434,7 @@
 		A7F2D6E122B25EF30093000B /* CardContentPicVideoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F2D6E022B25EF30093000B /* CardContentPicVideoModel.swift */; };
 		A7F3069122E1698400DC7917 /* json_Image_0.png in Resources */ = {isa = PBXBuildFile; fileRef = A7F3069022E1698400DC7917 /* json_Image_0.png */; };
 		A7F3069422E16A5B00DC7917 /* MineRouterModuleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F3069322E16A5B00DC7917 /* MineRouterModuleType.swift */; };
+		A7F3069722E1AE9600DC7917 /* MessageModuleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F3069622E1AE9600DC7917 /* MessageModuleManager.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 */; };
@@ -1155,6 +1156,7 @@
 		A7F2D6E022B25EF30093000B /* CardContentPicVideoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardContentPicVideoModel.swift; sourceTree = "<group>"; };
 		A7F3069022E1698400DC7917 /* json_Image_0.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = json_Image_0.png; sourceTree = "<group>"; };
 		A7F3069322E16A5B00DC7917 /* MineRouterModuleType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MineRouterModuleType.swift; sourceTree = "<group>"; };
+		A7F3069622E1AE9600DC7917 /* MessageModuleManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageModuleManager.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>"; };
@@ -2319,6 +2321,7 @@
 		A72A725422321B9400B21995 /* Manager */ = {
 			isa = PBXGroup;
 			children = (
+				A7F3069522E1AE7D00DC7917 /* MessageModuleManager */,
 				A743229922B8C1440017C367 /* AppStoreManager */,
 				A73A56DC22DC9CB8004920FE /* UpdateVersionManager */,
 				A797FDE922C5AC570076DCB3 /* CacheManager */,
@@ -4465,6 +4468,14 @@
 			path = JSON;
 			sourceTree = "<group>";
 		};
+		A7F3069522E1AE7D00DC7917 /* MessageModuleManager */ = {
+			isa = PBXGroup;
+			children = (
+				A7F3069622E1AE9600DC7917 /* MessageModuleManager.swift */,
+			);
+			path = MessageModuleManager;
+			sourceTree = "<group>";
+		};
 		A7FF1550228AC22700A85748 /* ProductAllComment */ = {
 			isa = PBXGroup;
 			children = (
@@ -6225,6 +6236,7 @@
 				A74322AB22B900F00017C367 /* CommunityFindFriendsView.swift in Sources */,
 				BD3474F522857B85000908C5 /* CommonPayHeader.swift in Sources */,
 				A71AF0B6226EF99A001730FE /* SearchResultViewController.swift in Sources */,
+				A7F3069722E1AE9600DC7917 /* MessageModuleManager.swift in Sources */,
 				A757C9302274839900226355 /* SelfMentionAddressListModel.swift in Sources */,
 				BD6122B922C3639E00D3F513 /* AlivcEditBottomHeaderView.m in Sources */,
 				BDD22F0B228FAA5B00D43BFB /* ImageUrlModel.swift in Sources */,

+ 3 - 0
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -45,6 +45,7 @@ extension AppDelegate {
 
                 SwiftMoyaNetWorkServiceUser.shared().userRefreshApi {[weak self] _ in
                     self?.setTabbarController()
+
                 }
             }else {// 设置登录
                 setLoginController()
@@ -61,6 +62,8 @@ extension AppDelegate {
     /// 设置Tabbar
     func setTabbarController() {
         self.window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
+        //获取消息的小红点
+        MessageModuleManager.shared.userMemberMessageIndexApi()
     }
 
     /// 设置Login

+ 0 - 16
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate.swift

@@ -18,7 +18,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         initWindow()
         //版本更新
 //        _ = UpdateVersionManager.shared
-
         //初始化百度地图
         BaiduMapManager.shared.initBaiduMap()
         //百度定位
@@ -29,19 +28,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
         IQKeyboardManagerSwiftManager.shared().initIQKeyboardManagerSwift()
         return true
     }
-    
-    ///当App将从后台回到前台时调用,之后肯定调用applicationDidBecomeActive方法表示程序进入active状态,但App第一次启动时不是从后台启动,所以首次加载时不会调用此方法.
-    func applicationWillEnterForeground(_ application: UIApplication) {
-        SwiftMoyaNetWorkServiceUser.shared().userMemberMessageIndexApi {
-            (messageIndexModel) -> (Void) in
-            let messageIndexModel = messageIndexModel as? MessageIndexModel
-            if messageIndexModel?.activity?.isYes == 1 || messageIndexModel?.follow?.isYes == 1 || messageIndexModel?.notification?.isYes == 1 || messageIndexModel?.praise?.isYes == 1 || messageIndexModel?.comment?.isYes == 1 {
-                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "MessageMainViewController"), object: messageIndexModel)
-            }
-            
-        }
-    }
-    
-    
-
 }

+ 25 - 5
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -82,15 +82,15 @@ class BaseTabbarViewController: ESTabBarController {
     static let shared : BaseTabbarViewController = BaseTabbarViewController()
     
     /// 社区
-    let v1 = CommunityViewController()
+    var v1 = CommunityViewController()
     /// 商城
-    let v2 = ShoppingMallViewController()
+    var v2 = ShoppingMallViewController()
     /// 发布
-    let v3 = UIViewController()
+    var v3 = UIViewController()
     /// 消息
-    let v4 = MessageMainViewController()
+    var v4 = MessageMainViewController()
     /// 我的
-    let v5 = UserPersonalCenterViewController()
+    var v5 = UserPersonalCenterViewController()
     
     /// 社区
     let lottieAnimateContentView1 = BaseLottieAnimateContentView(jsonStr: "communityModuleTabbar")
@@ -147,13 +147,33 @@ class BaseTabbarViewController: ESTabBarController {
         setBadge()
         NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
             [weak self] (notification) in
+            //获取消息的小红点
+            MessageModuleManager.shared.userMemberMessageIndexApi()
             self?.setBadge()
         })
+        //监听消息
+        NotificationCenter.default.addObserver(forName: NSNotification.Name("MessageMainViewController"), object: nil, queue: OperationQueue.main) {
+            [weak self] notification in
+            self?.setBadge()
+        }
         return tabBarViewController
     }
     
     // 设置Badge
     func setBadge() {
+        //消息
+        let messageIndexModel = MessageIndexModel.shared.object()
+        if messageIndexModel?.activity?.isYes == 1 || messageIndexModel?.follow?.isYes == 1 || messageIndexModel?.notification?.isYes == 1 || messageIndexModel?.praise?.isYes == 1 || messageIndexModel?.comment?.isYes == 1 {
+            let tabBarItem = v4.tabBarItem as? ESTabBarItem
+            tabBarItem?.contentView?.badgeColor = kFE352BColor
+            tabBarItem?.contentView?.badgeValue = ""
+            tabBarItem?.contentView?.badgeOffset = UIOffset(horizontal: 0, vertical: -22)
+        }else {
+            let tabBarItem = v4.tabBarItem as? ESTabBarItem
+            tabBarItem?.contentView?.badgeValue = nil
+        }
+        
+        //我的
         if UpdateVersionModel.shared.object()?.upGradeModelType == .update ||  UpdateVersionModel.shared.object()?.upGradeModelType == .strongUpdate {
 
             let tabBarItem = v5.tabBarItem as? ESTabBarItem

+ 24 - 0
RainbowPlanet/RainbowPlanet/Manager/MessageModuleManager/MessageModuleManager.swift

@@ -0,0 +1,24 @@
+//
+//  MessageModuleManager.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/19.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class MessageModuleManager: NSObject {
+    static let shared : MessageModuleManager = MessageModuleManager()
+    
+    /// 获取message信息
+    func userMemberMessageIndexApi() {
+        SwiftMoyaNetWorkServiceUser.shared().userMemberMessageIndexApi {
+            (messageIndexModel) -> (Void) in
+            let messageIndexModel = messageIndexModel as? MessageIndexModel
+            if messageIndexModel?.activity?.isYes == 1 || messageIndexModel?.follow?.isYes == 1 || messageIndexModel?.notification?.isYes == 1 || messageIndexModel?.praise?.isYes == 1 || messageIndexModel?.comment?.isYes == 1 {
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "MessageMainViewController"), object: messageIndexModel)
+            }
+        }
+    }
+}

+ 16 - 1
RainbowPlanet/RainbowPlanet/Model/UserModel/MessageIndexModel.swift

@@ -4,9 +4,12 @@
 
 import Foundation 
 import ObjectMapper
+import SwiftyJSON
 
 
 class MessageIndexModel : NSObject, Mappable{
+    
+    static let shared : MessageIndexModel = MessageIndexModel()
 
 	var activity : MessageModel?
 	var comment : MessageModel?
@@ -18,7 +21,7 @@ class MessageIndexModel : NSObject, Mappable{
 		return MessageIndexModel()
 	}
 	required init?(map: Map){}
-	private override init(){}
+	override init(){}
 
 	func mapping(map: Map)
 	{
@@ -29,6 +32,18 @@ class MessageIndexModel : NSObject, Mappable{
 		praise <- map["praise"]
 		
 	}
+    
+    func saveObject(model: MessageIndexModel) {
+        var cacheModel = CacheModel()
+        cacheModel.data = jsonToData(jsonDic: model.toJSON())
+        CacheManager.default.setObjectSync(cacheModel, forKey: "MessageIndexModel")
+    }
+    
+    func object() -> MessageIndexModel? {
+        let  cacheModel = CacheManager.default.objectSync(forKey: "MessageIndexModel")
+        let json = try? JSON(data: cacheModel?.data ?? Data())
+        return MessageIndexModel(JSONString: json?.description ?? "")
+    }
 
 }
 

+ 8 - 8
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/TitleContent/CardContentTitleTableViewCell.swift

@@ -82,13 +82,13 @@ class CardContentTitleTableViewCell: UITableViewCell {
     var communityRecommendDataModel: CommunityRecommendDataModel? {
         didSet {
             if (communityRecommendDataModel?.title == "" || communityRecommendDataModel?.title == nil) {
-                if communityRecommendDataModel?.content?.count ?? 0 >= 46 {
+                if communityRecommendDataModel?.content?.count ?? 0 >= 45 {
                     cardContentTitleTableViewCellType = .noTitleMoreThan
                 }else {
                     cardContentTitleTableViewCellType = .noTitleNoMoreThan
                 }
             }else {
-                if communityRecommendDataModel?.content?.count ?? 0 >= 46 {
+                if communityRecommendDataModel?.content?.count ?? 0 >= 45 {
                     cardContentTitleTableViewCellType = .titleMoreThan
                 }else {
                     cardContentTitleTableViewCellType = .titleNoMoreThan
@@ -214,13 +214,13 @@ class CardContentTitleTableViewCell: UITableViewCell {
     var communityFollowDataModel : CommunityFollowDataModel? {
         didSet {
             if (communityFollowDataModel?.relateData?.title == "" || communityFollowDataModel?.relateData?.title == nil) {
-                if communityFollowDataModel?.relateData?.content?.count ?? 0 >= 46 {
+                if communityFollowDataModel?.relateData?.content?.count ?? 0 >= 45 {
                     cardContentTitleTableViewCellType1 = .noTitleMoreThan
                 }else {
                     cardContentTitleTableViewCellType1 = .noTitleNoMoreThan
                 }
             }else {
-                if communityFollowDataModel?.relateData?.content?.count ?? 0 >= 46 {
+                if communityFollowDataModel?.relateData?.content?.count ?? 0 >= 45 {
                     cardContentTitleTableViewCellType1 = .titleMoreThan
                 }else {
                     cardContentTitleTableViewCellType1 = .titleNoMoreThan
@@ -238,8 +238,8 @@ class CardContentTitleTableViewCell: UITableViewCell {
                     subtitleLabel.isHidden = false
                     var str = communityFollowDataModel?.relateData?.content ?? ""
                     
-                    if str.count >= 46 {
-                        str = String(str.prefix(46) + "...更多")
+                    if str.count >= 45 {
+                        str = String(str.prefix(45) + "...更多")
                         let str1 = str.suffix(2)
                         subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
                         
@@ -278,8 +278,8 @@ class CardContentTitleTableViewCell: UITableViewCell {
                 if PostType(rawValue: communityFollowDataModel?.relateData?.type ?? "image") != .html {
                     subtitleLabel.isHidden = false
                     var str = communityFollowDataModel?.relateData?.content ?? ""
-                    if str.count >= 46 {
-                        str = String(str.prefix(46) + "...更多")
+                    if str.count >= 45 {
+                        str = String(str.prefix(45) + "...更多")
                         let str1 = str.suffix(2)
                         subtitleLabel.attributedText = str.changeTextColorFont(rangStr: String(str1), rangColor: k313334Color, font: kMediumFont14!)
                         

+ 9 - 13
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/CommunityNavigationBarView.swift

@@ -21,21 +21,23 @@ class CommunityNavigationBarView: BaseView {
     
     typealias SearchClosure = () -> Void
     var searchClosure:SearchClosure?
+    var scrollNumberLabel : DPScrollNumberLabel?
     
     override func setupViews() {
+        scrollNumberLabel = DPScrollNumberLabel.init(number: 0, fontSize: 16, textColor: kFFA42FColor, signSetting: SignSetting.unsigned)
         addSubview(leftButton)
         addSubview(rightButton)
-        addSubview(scrollNumberLabel)
+        addSubview(scrollNumberLabel!)
         addSubview(searchBgView)
         searchBgView.addSubview(searchIconImageView)
         searchBgView.addSubview(searchTextField)
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("userMemberGetTotalBean"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
             let totalBeanModel = notification.object as? TotalBeanModel
-            self?.scrollNumberLabel.change(to: NSNumber(value: totalBeanModel?.todayBean ?? 0) , animated: true)
+            self?.scrollNumberLabel!.change(to: NSNumber(value: totalBeanModel?.todayBean ?? 0) , animated: true)
             
-            self?.scrollNumberLabel.snp_remakeConstraints { (make) in
+            self?.scrollNumberLabel!.snp_remakeConstraints { (make) in
                 make.centerY.equalToSuperview()
-                make.size.equalTo((self?.scrollNumberLabel.frame.size)!)
+                make.size.equalTo((self?.scrollNumberLabel!.frame.size)!)
                 make.right.equalToSuperview().offset(-14)
             }
         }
@@ -53,14 +55,14 @@ class CommunityNavigationBarView: BaseView {
         
         rightButton.snp.makeConstraints { (make) in
             make.centerY.equalToSuperview()
-            make.right.equalTo(scrollNumberLabel.snp_left).offset(-2)
+            make.right.equalTo(scrollNumberLabel!.snp_left).offset(-2)
             make.height.equalTo(20)
             make.width.greaterThanOrEqualTo(20)
         }
         
-        scrollNumberLabel.snp_makeConstraints { (make) in
+        scrollNumberLabel!.snp_makeConstraints { (make) in
             make.centerY.equalToSuperview()
-            make.size.equalTo(scrollNumberLabel.frame.size)
+            make.size.equalTo(scrollNumberLabel!.frame.size)
             make.right.equalToSuperview().offset(-14)
         }
         
@@ -105,12 +107,6 @@ class CommunityNavigationBarView: BaseView {
         return rightButton
     }()
     
-    lazy var scrollNumberLabel: DPScrollNumberLabel = {
-        let scrollNumberLabel = DPScrollNumberLabel.init(number: 0, fontSize: 16, textColor: kFFA42FColor, signSetting: SignSetting.unsigned)
-
-        return scrollNumberLabel!
-    }()
-    
     private lazy var searchBgView: UIView = {
         let searchBgView = UIView()
         searchBgView.backgroundColor = kf7f8faColor

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

@@ -110,7 +110,7 @@ class CommunityFollowViewController: UIViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityFollowDataModels.isEmpty ?? true) {
                 for communityFollowDataModel in (self?.communityFollowDataModels)! {
-                    if communityFollowDataModel.relateData?.uid == followStatusModel?.uid {
+                    if communityFollowDataModel.relateData?.id == followStatusModel?.postId {
                         communityFollowDataModel.relateData?.isLike = followStatusModel?.isFollowStatus
                     }
                 }
@@ -122,7 +122,7 @@ class CommunityFollowViewController: UIViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityFollowDataModels.isEmpty ?? true) {
                 for communityFollowDataModel in (self?.communityFollowDataModels)! {
-                    if communityFollowDataModel.relateData?.uid == followStatusModel?.uid {
+                    if communityFollowDataModel.relateData?.id == followStatusModel?.postId {
                         communityFollowDataModel.relateData?.isCollect = followStatusModel?.isFollowStatus
                     }
                 }

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

@@ -85,7 +85,7 @@ class CommunityRecommnendViewController: UIViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityRecommendDataModels.isEmpty ?? true) {
                 for communityRecommendDataModel in (self?.communityRecommendDataModels)! {
-                    if communityRecommendDataModel.uid == followStatusModel?.uid {
+                    if communityRecommendDataModel.id == followStatusModel?.postId {
                         communityRecommendDataModel.isLike = followStatusModel?.isFollowStatus
                     }
                 }
@@ -97,7 +97,7 @@ class CommunityRecommnendViewController: UIViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityRecommendDataModels.isEmpty ?? true) {
                 for communityRecommendDataModel in (self?.communityRecommendDataModels)! {
-                    if communityRecommendDataModel.uid == followStatusModel?.uid {
+                    if communityRecommendDataModel.id == followStatusModel?.postId {
                         communityRecommendDataModel.isCollect = followStatusModel?.isFollowStatus
                     }
                 }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -216,7 +216,7 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityRecommendDataModels.isEmpty ?? true) {
                 for communityRecommendDataModel in (self?.communityRecommendDataModels)! {
-                    if communityRecommendDataModel.uid == followStatusModel?.uid {
+                    if communityRecommendDataModel.id == followStatusModel?.postId {
                         communityRecommendDataModel.isLike = followStatusModel?.isFollowStatus
                     }
                 }
@@ -228,7 +228,7 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityRecommendDataModels.isEmpty ?? true) {
                 for communityRecommendDataModel in (self?.communityRecommendDataModels)! {
-                    if communityRecommendDataModel.uid == followStatusModel?.uid {
+                    if communityRecommendDataModel.id == followStatusModel?.postId {
                         communityRecommendDataModel.isCollect = followStatusModel?.isFollowStatus
                     }
                 }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -224,7 +224,7 @@ class CommunityRecommendController: BaseViewController {
         
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("islikeApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
             let followStatusModel = notification.object as? FollowStatusModel
-            if self?.communityPostDetailModel?.uid == followStatusModel?.uid {
+            if self?.communityPostDetailModel?.id == followStatusModel?.postId {
                 self?.communityPostDetailModel?.isDislike = followStatusModel?.isFollowStatus
                 self?.commentView.communityPostDetailModel = self?.communityPostDetailModel
             }
@@ -241,7 +241,7 @@ class CommunityRecommendController: BaseViewController {
         
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("isCollectApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
             let followStatusModel = notification.object as? FollowStatusModel
-            if self?.communityPostDetailModel?.uid == followStatusModel?.uid {
+            if self?.communityPostDetailModel?.id == followStatusModel?.postId {
                 self?.communityPostDetailModel?.isCollect = followStatusModel?.isFollowStatus
                 self?.commentView.communityPostDetailModel = self?.communityPostDetailModel
                 self?.tableView.reloadData()

+ 7 - 3
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessageMain/ViewController/MessageMainViewController.swift

@@ -8,6 +8,7 @@
 
 import UIKit
 import Lottie
+import ESTabBarController_swift
 
 class MessageMainViewController: BaseViewController {
     
@@ -247,10 +248,13 @@ extension MessageMainViewController: UICollectionViewDelegateFlowLayout,UICollec
     
     func setTabBarItemBadge() {
         if self.messageIndexModel?.activity?.isYes == 1 || self.messageIndexModel?.follow?.isYes == 1 || self.messageIndexModel?.notification?.isYes == 1 || self.messageIndexModel?.praise?.isYes ==  1 ||  self.messageIndexModel?.comment?.isYes == 1{
-            self.tabBarItem.pp.moveBadge(x: -1, y: 3)
-            self.tabBarItem.pp.addDot(color: kFE352BColor)
+            let tabBarItem = self.tabBarItem as? ESTabBarItem
+            tabBarItem?.contentView?.badgeColor = kFE352BColor
+            tabBarItem?.contentView?.badgeValue = ""
+            tabBarItem?.contentView?.badgeOffset = UIOffset(horizontal: 0, vertical: -22)
         }else {
-            self.tabBarItem.pp.hiddenBadge()
+            let tabBarItem = self.tabBarItem as? ESTabBarItem
+            tabBarItem?.contentView?.badgeValue = nil
         }
     }
 

+ 9 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListCollectionViewCell.swift

@@ -115,6 +115,15 @@ class PersonViewUserAndOtherListCollectionViewCell: UICollectionViewCell {
             }else {
                 videoImageView.isHidden = true
             }
+            if uid == UserModel.shared().getModel()?.uid {
+                rainbowBeanImageView.isHidden = false
+                rainbowBeanNumberLabel.isHidden = false
+            }else {
+                rainbowBeanImageView.isHidden = true
+                rainbowBeanNumberLabel.isHidden = true
+            }
+            
         }
     }
+    var uid: Int?
 }

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/PersonalCenterView/PersonViewUserAndOtherListView.swift

@@ -114,6 +114,7 @@ extension PersonViewUserAndOtherListView: UICollectionViewDelegateFlowLayout,UIC
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = PersonViewUserAndOtherListCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+        cell.uid = self.uid
         cell.postMyModel = postMyModels[indexPath.row]
         return cell
         

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/ViewController/SearchContentListViewController.swift

@@ -60,7 +60,7 @@ class SearchContentListViewController: UIViewController {
             let followStatusModel = notification.object as? FollowStatusModel
             if !(self?.communityPostDataModels.isEmpty ?? true) {
                 for communityPostDataModel in (self?.communityPostDataModels)! {
-                    if communityPostDataModel.uid == followStatusModel?.uid {
+                    if communityPostDataModel.id == followStatusModel?.postId {
                         communityPostDataModel.isLike = followStatusModel?.isFollowStatus
                     }
                 }

+ 1 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

@@ -667,6 +667,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         let parameters = Dictionary<String,Any>()
         SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared.requestObject(MessageIndexModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userMemberMessageIndex(parameters: parameters))) { (messageIndexModel) in
+            MessageIndexModel.shared.saveObject(model: messageIndexModel as! MessageIndexModel)
             SwiftProgressHUD.shared().hide()
             completion(messageIndexModel)
         }

+ 1 - 3
RainbowPlanet/RainbowPlanet/ViewModel/UserMemberTotalBeanViewModel/UserMemberTotalBeanViewModel.swift

@@ -18,9 +18,7 @@ class UserMemberTotalBeanViewModel: NSObject {
     func userMemberGetTotalBeanApi() {
         if UserModel.shared().getModel()?.token != nil {
             SwiftMoyaNetWorkServiceUser.shared().userMemberGetTotalBeanApi(completion: { (totalBeanModel) -> (Void) in
-                if UserModel.shared().getModel()?.token != nil {
-                    
-                }
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "userMemberGetTotalBean"), object: totalBeanModel)
             })
         }
     }

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

@@ -101,6 +101,7 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityRecommendDataModel.uid!
+            followStatusModel.postId = communityRecommendDataModel.id
             if communityRecommendDataModel.isLike == 0 {
                 followStatusModel.isFollowStatus = 1
                 completion(1)
@@ -163,6 +164,7 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityRecommendDataModel.uid
+            followStatusModel.postId = communityRecommendDataModel.id
             if communityRecommendDataModel.isCollect == 0 {
                 followStatusModel.isFollowStatus = 1
 
@@ -281,6 +283,8 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityFollowDataModel.relateData?.uid!
+            followStatusModel.postId = communityFollowDataModel.relateData?.id
+
             if communityFollowDataModel.relateData?.isLike == 0 {
                 followStatusModel.isFollowStatus = 1
                 completion(1)
@@ -342,6 +346,7 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityFollowDataModel.relateData?.uid
+            followStatusModel.postId = communityFollowDataModel.relateData?.id
             if communityFollowDataModel.relateData?.isCollect == 0 {
                 followStatusModel.isFollowStatus = 1
                 completion(1)
@@ -400,6 +405,8 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityVideoItemModel.uid!
+            followStatusModel.postId = communityVideoItemModel.id
+
             if communityVideoItemModel.isLike == 0 {
                 followStatusModel.isFollowStatus = 1
                 completion(1)
@@ -460,6 +467,7 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityVideoItemModel.uid
+            followStatusModel.postId = communityVideoItemModel.id
             if communityVideoItemModel.isCollect == 0 {
                 followStatusModel.isFollowStatus = 1
 
@@ -633,6 +641,8 @@ extension VirusViewModel {
         SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityPostDetailModel?.uid
+            followStatusModel.postId = communityPostDetailModel?.id
+
             if communityPostDetailModel?.isLike == 0 {
                 followStatusModel.isFollowStatus = 1
 
@@ -681,6 +691,7 @@ extension VirusViewModel {
             
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityPostDetailModel?.uid
+            followStatusModel.postId = communityPostDetailModel?.id
 
             if communityPostDetailModel?.isCollect == 0 {
                 communityPostDetailModel?.isCollect = 1
@@ -728,6 +739,8 @@ extension VirusViewModel {
             (data) -> (Void) in
             let followStatusModel = FollowStatusModel()
             followStatusModel.uid = communityPostDataModel.uid
+            followStatusModel.postId = communityPostDataModel.id
+
             if communityPostDataModel.isLike == 0 {
                 communityPostDataModel.isLike = 1
                 followStatusModel.isFollowStatus = 1