Просмотр исходного кода

修复了跟H5用户信息安卓段不一致的问题

南鑫林 лет назад: 5
Родитель
Сommit
d74cd30ca7

+ 4 - 8
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -374,6 +374,7 @@
 		A7AD2795231365470099B3E0 /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2794231365470099B3E0 /* QRCode.swift */; };
 		A7B4E7352281907A0012914A /* CMSModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E7342281907A0012914A /* CMSModel.swift */; };
 		A7B4E73A228192D20012914A /* CMSTemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E739228192D10012914A /* CMSTemplateModel.swift */; };
+		A7B77393236A897800BF26F1 /* Extension+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B77392236A897800BF26F1 /* Extension+Dictionary.swift */; };
 		A7BA1902230EA80000E3B969 /* TGCaculateNumberTool.m in Sources */ = {isa = PBXBuildFile; fileRef = A7BA1901230EA80000E3B969 /* TGCaculateNumberTool.m */; };
 		A7BB684F2268DCEC00AB07A2 /* SelfRecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB684D2268DCEC00AB07A2 /* SelfRecommendationViewController.swift */; };
 		A7BB68552268DE8600AB07A2 /* SelfRecommendationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB68542268DE8600AB07A2 /* SelfRecommendationView.swift */; };
@@ -1127,6 +1128,7 @@
 		A7AD2794231365470099B3E0 /* QRCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCode.swift; sourceTree = "<group>"; };
 		A7B4E7342281907A0012914A /* CMSModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSModel.swift; sourceTree = "<group>"; };
 		A7B4E739228192D10012914A /* CMSTemplateModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSTemplateModel.swift; sourceTree = "<group>"; };
+		A7B77392236A897800BF26F1 /* Extension+Dictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+Dictionary.swift"; sourceTree = "<group>"; };
 		A7BA1900230EA80000E3B969 /* TGCaculateNumberTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TGCaculateNumberTool.h; sourceTree = "<group>"; };
 		A7BA1901230EA80000E3B969 /* TGCaculateNumberTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TGCaculateNumberTool.m; sourceTree = "<group>"; };
 		A7BB684D2268DCEC00AB07A2 /* SelfRecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfRecommendationViewController.swift; sourceTree = "<group>"; };
@@ -2239,6 +2241,7 @@
 				A7778CA82244904500C7C47A /* Extension+Gifu.GIFImageView.swift */,
 				A72A729822321DE000B21995 /* Extension+RxTimer.swift */,
 				A747D80D235C64AB007F4E33 /* Extension+Data.swift */,
+				A7B77392236A897800BF26F1 /* Extension+Dictionary.swift */,
 			);
 			path = Extension;
 			sourceTree = "<group>";
@@ -2276,7 +2279,6 @@
 		A72C011E227539800065E0C3 /* Src */ = {
 			isa = PBXGroup;
 			children = (
-				A7811C8D231CBBF400C2D8DE /* img */,
 				A78A5F7422FAA01F00DD1764 /* Gif */,
 				A763BE7A22F28376000CE594 /* Video */,
 				A75B787522E079BC007B986A /* AnimationJSON */,
@@ -3401,13 +3403,6 @@
 			path = OtherPersonalCenterReportView;
 			sourceTree = "<group>";
 		};
-		A7811C8D231CBBF400C2D8DE /* img */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = img;
-			sourceTree = "<group>";
-		};
 		A7811C9E231FB13700C2D8DE /* KSDisclosureIndicator */ = {
 			isa = PBXGroup;
 			children = (
@@ -6346,6 +6341,7 @@
 				A7D5F24D22BC720000F8E9AF /* WVJBModel.swift in Sources */,
 				A74322A222B8D5A90017C367 /* SearchUserLitTableViewCell.swift in Sources */,
 				A77BB4592329ECF900DCAE32 /* NXLPermissionAlwaysAuthorizationLocationHandler.swift in Sources */,
+				A7B77393236A897800BF26F1 /* Extension+Dictionary.swift in Sources */,
 				A7F577CD22FECD7C00E2D757 /* AliyunVodupToyoPublishManager.swift in Sources */,
 				A76893982339C9EB00819EC3 /* StartupModel.swift in Sources */,
 				A77BB4612329EEDF00DCAE32 /* NXLPermissionMediaLibrary.swift in Sources */,

+ 52 - 17
RainbowPlanet/RainbowPlanet/Model/UserModel/UserModel.swift

@@ -5,6 +5,7 @@
 import Foundation 
 import ObjectMapper
 import Kingfisher
+import SwiftyJSON
 
 
 public class UserModel : NSObject, NSCoding, Mappable{
@@ -17,19 +18,19 @@ public class UserModel : NSObject, NSCoding, Mappable{
         return _sharedInstance
     }
 
-    var accessToken : String?
-    var avatarurl : String?
-    var gender : Int?
-    var isPassword : Int?
-    var mobile : String?
-    var token : String?
-    var tokenTtl : Int?
-    var uid : Int?
-    var username : String?
-    var isFollowSuggestTopic : Int?
-    var isNewMember : Int?
-    var inviteUid : Int?
-    var inviteCode : String?
+    var accessToken : String? = ""
+    var avatarurl : String? = ""
+    var gender : Int? = nil
+    var isPassword : Int? = nil
+    var mobile : String? = ""
+    var token : String? = ""
+    var tokenTtl : Int? = nil
+    var uid : Int? = nil
+    var username : String? = ""
+    var isFollowSuggestTopic : Int? = nil
+    var isNewMember : Int? = nil
+    var inviteUid : Int? = nil
+    var inviteCode : String? = ""
     var bindWeixinUserModel : BindThirdPartyUserModel?
     var bindQQUserModel : BindThirdPartyUserModel?
     
@@ -199,9 +200,43 @@ public class UserModel : NSObject, NSCoding, Mappable{
         //获取当前时间
         let userModel = getModel()
         userModel?.version = AppInfo.clientVersion
+        
         var userInfoDic = Dictionary<String,Any>()
         userInfoDic.updateValue("userInfo", forKey: "type")
-        userInfoDic.updateValue(userModel?.toJSON() as Any, forKey: "params")
+        var userModelDic = Dictionary<String,Any>()
+        if userModel?.gender == nil {
+            userModelDic.updateValue("" as Any, forKey: "gender")
+        }
+        if userModel?.isPassword == nil {
+            userModelDic.updateValue("" as Any, forKey: "is_password")
+        }
+        if userModel?.tokenTtl == nil {
+            userModelDic.updateValue("" as Any, forKey: "token_ttl")
+        }
+        if userModel?.uid == nil {
+            userModelDic.updateValue("" as Any, forKey: "uid")
+        }
+        if userModel?.isFollowSuggestTopic == nil {
+            userModelDic.updateValue("" as Any, forKey: "is_follow_suggest_topic")
+        }
+        if userModel?.isNewMember == nil {
+            userModelDic.updateValue("" as Any, forKey: "is_new_member")
+        }
+        if userModel?.inviteUid == nil {
+            userModelDic.updateValue("" as Any, forKey: "invite_uid")
+        }
+        
+        if userModel?.bindWeixinUserModel == nil {
+            userModel?.bindWeixinUserModel = BindThirdPartyUserModel()
+        }
+        
+        if userModel?.bindQQUserModel == nil {
+            userModel?.bindQQUserModel = BindThirdPartyUserModel()
+        }
+        
+        userModelDic.append(dict: (userModel?.toJSON())!)
+        userInfoDic.updateValue(userModelDic as Any, forKey: "params")
+        NXLLog(JSON(userInfoDic).debugDescription)
         return userInfoDic
     }
 
@@ -226,15 +261,15 @@ public class UserModel : NSObject, NSCoding, Mappable{
 
 class BindThirdPartyUserModel : NSObject, NSCoding, Mappable{
     
-    var openId : String?
-    var unionId : String?
+    var openId : String? = ""
+    var unionId : String? = ""
     
     
     class func newInstance(map: Map) -> Mappable?{
         return BindThirdPartyUserModel()
     }
     required init?(map: Map){}
-    private override init(){}
+    override init(){}
     
     func mapping(map: Map)
     {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/BackyardModule/Backyard/ViewController/BackyardViewController.swift

@@ -80,7 +80,7 @@ class BackyardViewController: BaseJSWebViewController {
         //将要进入前台的时候
         observe = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
             [weak self] (notification) in
-            WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
+//            WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
         })
 
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("BackyardViewModuleTop"), object: nil, queue: OperationQueue.main, using: {

+ 4 - 4
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/ApiMacro.swift

@@ -10,14 +10,14 @@ import Foundation
 
 /// Service
 let kPersonalService = false
-let kDevelopSever = false
-let kBetaSever = true
+let kDevelopSever = true
+let kBetaSever = false
 let kProductSever = false
 
 /// H5Service
-let kH5PersonalService = false
+let kH5PersonalService = true
 let kH5DevelopSever = false
-let kH5BetaSever = true
+let kH5BetaSever = false
 let kH5ProductSever = false
 
 // MARK: - 数据服务器

+ 18 - 0
RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+Dictionary.swift

@@ -0,0 +1,18 @@
+//
+//  Extension+Dictionary.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/10/31.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+
+extension Dictionary {
+    
+    mutating func append(dict: Dictionary) {
+        dict.forEach { (key, value) in
+            self.updateValue(value, forKey: key)
+        }
+    }
+}