Parcourir la source

网络请求封装

南鑫林 il y a 6 ans
Parent
commit
54ecdcaff5
16 fichiers modifiés avec 385 ajouts et 54 suppressions
  1. 28 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallBanner/ShoppingMallBannerTableViewCell.swift
  3. 1 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ShoppingMallBarChart/ShoppingMallBarChartCollectionViewCell.swift
  4. 203 0
      RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSModel.swift
  5. 54 0
      RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSTemplateModel.swift
  6. 13 0
      RainbowPlanet/RainbowPlanet/Service/Model/CommonModel/CommondModel.swift
  7. 6 6
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift
  8. 79 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift
  9. 0 23
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/Contents.json
  10. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/home_btn_buy.png
  11. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/home_btn_buy@2x.png
  12. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/home_btn_buy@3x.png
  13. 0 23
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/Contents.json
  14. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/home_pic_banner_06.png
  15. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/home_pic_banner_06@2x.png
  16. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/home_pic_banner_06@3x.png

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

@@ -193,6 +193,9 @@
 		A7B4E72B2281752B0012914A /* ShoppingMallBarChartTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E72A2281752B0012914A /* ShoppingMallBarChartTableViewCell.swift */; };
 		A7B4E72D228176060012914A /* ShoppingMallBarChartCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E72C228176060012914A /* ShoppingMallBarChartCollectionViewCell.swift */; };
 		A7B4E72F2281773F0012914A /* FloorTitleCenterBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E72E2281773F0012914A /* FloorTitleCenterBaseView.swift */; };
+		A7B4E7352281907A0012914A /* CMSModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E7342281907A0012914A /* CMSModel.swift */; };
+		A7B4E738228191CC0012914A /* CommondModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E737228191CC0012914A /* CommondModel.swift */; };
+		A7B4E73A228192D20012914A /* CMSTemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B4E739228192D10012914A /* CMSTemplateModel.swift */; };
 		A7BB684F2268DCEC00AB07A2 /* SelfRecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB684D2268DCEC00AB07A2 /* SelfRecommendationViewController.swift */; };
 		A7BB68552268DE8600AB07A2 /* SelfRecommendationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB68542268DE8600AB07A2 /* SelfRecommendationView.swift */; };
 		A7BB6857226965C100AB07A2 /* SelfRecommendationHeaderCollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7BB6856226965C100AB07A2 /* SelfRecommendationHeaderCollectionReusableView.swift */; };
@@ -461,6 +464,9 @@
 		A7B4E72A2281752B0012914A /* ShoppingMallBarChartTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallBarChartTableViewCell.swift; sourceTree = "<group>"; };
 		A7B4E72C228176060012914A /* ShoppingMallBarChartCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallBarChartCollectionViewCell.swift; sourceTree = "<group>"; };
 		A7B4E72E2281773F0012914A /* FloorTitleCenterBaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloorTitleCenterBaseView.swift; sourceTree = "<group>"; };
+		A7B4E7342281907A0012914A /* CMSModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSModel.swift; sourceTree = "<group>"; };
+		A7B4E737228191CC0012914A /* CommondModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommondModel.swift; sourceTree = "<group>"; };
+		A7B4E739228192D10012914A /* CMSTemplateModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSTemplateModel.swift; sourceTree = "<group>"; };
 		A7BB684D2268DCEC00AB07A2 /* SelfRecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfRecommendationViewController.swift; sourceTree = "<group>"; };
 		A7BB68542268DE8600AB07A2 /* SelfRecommendationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfRecommendationView.swift; sourceTree = "<group>"; };
 		A7BB6856226965C100AB07A2 /* SelfRecommendationHeaderCollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfRecommendationHeaderCollectionReusableView.swift; sourceTree = "<group>"; };
@@ -1111,10 +1117,12 @@
 		A738D203225AEAD000EEE860 /* Model */ = {
 			isa = PBXGroup;
 			children = (
+				A7B4E736228190810012914A /* CommonModel */,
 				A72A73722233966800B21995 /* RootModel */,
 				A7A98E00227E88E8005306E9 /* ProductModel */,
 				A79057032276D5FE0037F823 /* ConfigModel */,
 				A7284402224DBE3500F82F30 /* UserModel */,
+				A7B4E733228190630012914A /* CMSModel */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -1810,6 +1818,23 @@
 			path = TitleBanner;
 			sourceTree = "<group>";
 		};
+		A7B4E733228190630012914A /* CMSModel */ = {
+			isa = PBXGroup;
+			children = (
+				A7B4E739228192D10012914A /* CMSTemplateModel.swift */,
+				A7B4E7342281907A0012914A /* CMSModel.swift */,
+			);
+			path = CMSModel;
+			sourceTree = "<group>";
+		};
+		A7B4E736228190810012914A /* CommonModel */ = {
+			isa = PBXGroup;
+			children = (
+				A7B4E737228191CC0012914A /* CommondModel.swift */,
+			);
+			path = CommonModel;
+			sourceTree = "<group>";
+		};
 		A7BB68512268DCF800AB07A2 /* SelfRecommendation */ = {
 			isa = PBXGroup;
 			children = (
@@ -2393,10 +2418,12 @@
 				A71AA51C227219EF008FF1A5 /* EditExpressAddressView.swift in Sources */,
 				A7CC751122715AE3003C4F38 /* MessageDetailesTimeView.swift in Sources */,
 				A7BB684F2268DCEC00AB07A2 /* SelfRecommendationViewController.swift in Sources */,
+				A7B4E7352281907A0012914A /* CMSModel.swift in Sources */,
 				A72A72BE22321DE000B21995 /* Extension+RxTimer.swift in Sources */,
 				A7CC74EA22706ACD003C4F38 /* MessageViewController.swift in Sources */,
 				A72A72C422321DE000B21995 /* Extension+CAGradientLayer.swift in Sources */,
 				A7778CA72243A05400C7C47A /* IQKeyboardManagerSwiftManager.swift in Sources */,
+				A7B4E738228191CC0012914A /* CommondModel.swift in Sources */,
 				A7CC74D4226FF1AA003C4F38 /* MineView.swift in Sources */,
 				A71AA5152272160A008FF1A5 /* ExpressAddressListTableViewCell.swift in Sources */,
 				A72A72B722321DE000B21995 /* Extension+NSMutableAttributedString.swift in Sources */,
@@ -2523,6 +2550,7 @@
 				A775CBFE2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift in Sources */,
 				A71AA5212272E527008FF1A5 /* Extension+UINavigationController.swift in Sources */,
 				A7CC751822716202003C4F38 /* SetView.swift in Sources */,
+				A7B4E73A228192D20012914A /* CMSTemplateModel.swift in Sources */,
 				A72A72C622321DE000B21995 /* WebView.swift in Sources */,
 				A72A72D122321E2700B21995 /* HTMLURLMacro.swift in Sources */,
 				A72A73162232481600B21995 /* WeChatpayManager.swift in Sources */,

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallBanner/ShoppingMallBannerTableViewCell.swift

@@ -24,7 +24,7 @@ class ShoppingMallBannerTableViewCell: UITableViewCell {
         }
     }
     
-     var imageNames = ["home_pic_banner_06","home_pic_banner_06","home_pic_banner_06"]
+     var imageNames = ["pic_preload","pic_preload","pic_preload"]
     
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ShoppingMallBannerTableViewCell {
         let ID = "ShoppingMallBannerTableViewCell"

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallFloor/ShoppingMallBarChart/ShoppingMallBarChartCollectionViewCell.swift

@@ -175,7 +175,7 @@ class ShoppingMallBarChartCollectionViewCell: UICollectionViewCell {
     
     private lazy var plusButton: UIButton = {
         let plusButton = UIButton(type: UIButton.ButtonType.custom)
-        plusButton.setImage(kImage(name: "home_btn_buy"), for: UIControl.State.normal)
+        plusButton.setImage(kImage(name: "shopping_mall_plus"), for: UIControl.State.normal)
         return plusButton
     }()
     

+ 203 - 0
RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSModel.swift

@@ -0,0 +1,203 @@
+//
+//	CMSModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+
+class CMSModel : NSObject, NSCoding, Mappable{
+
+	var applyType : String?
+	var content : [CMSContentModel]?
+	var title : String?
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return CMSModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		applyType <- map["apply_type"]
+		content <- map["content"]
+		title <- map["title"]
+		
+	}
+
+    /**
+    * NSCoding required initializer.
+    * Fills the data from the passed decoder
+    */
+    @objc required init(coder aDecoder: NSCoder)
+	{
+         applyType = aDecoder.decodeObject(forKey: "apply_type") as? String
+         content = aDecoder.decodeObject(forKey: "content") as? [CMSContentModel]
+         title = aDecoder.decodeObject(forKey: "title") as? String
+
+	}
+
+    /**
+    * NSCoding required method.
+    * Encodes mode properties into the decoder
+    */
+    @objc func encode(with aCoder: NSCoder)
+	{
+		if applyType != nil{
+			aCoder.encode(applyType, forKey: "apply_type")
+		}
+		if content != nil{
+			aCoder.encode(content, forKey: "content")
+		}
+		if title != nil{
+			aCoder.encode(title, forKey: "title")
+		}
+
+	}
+
+}
+
+class CMSContentModel : NSObject, NSCoding, Mappable{
+    
+    var areaType : String?
+    var rule : [CMSRuleModel]?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CMSContentModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        areaType <- map["area_type"]
+        rule <- map["rule"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        areaType = aDecoder.decodeObject(forKey: "area_type") as? String
+        rule = aDecoder.decodeObject(forKey: "rule") as? [CMSRuleModel]
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if areaType != nil{
+            aCoder.encode(areaType, forKey: "area_type")
+        }
+        if rule != nil{
+            aCoder.encode(rule, forKey: "rule")
+        }
+        
+    }
+    
+}
+
+class CMSRuleModel : NSObject, NSCoding, Mappable{
+    
+    var linkType : String?
+    var linkUrl : String?
+    var showNum : Int?
+    var title : String?
+    var url : String?
+    var id : Int?
+    var productId : String?
+    var rule : CMSRuleModel?
+    var showType : Int?
+    var subjectId : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CMSRuleModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        linkType <- map["link_type"]
+        linkUrl <- map["link_url"]
+        showNum <- map["show_num"]
+        title <- map["title"]
+        url <- map["url"]
+        id <- map["id"]
+        productId <- map["product_id"]
+        rule <- map["rule"]
+        showType <- map["show_type"]
+        subjectId <- map["subject_id"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        linkType = aDecoder.decodeObject(forKey: "link_type") as? String
+        linkUrl = aDecoder.decodeObject(forKey: "link_url") as? String
+        showNum = aDecoder.decodeObject(forKey: "show_num") as? Int
+        title = aDecoder.decodeObject(forKey: "title") as? String
+        url = aDecoder.decodeObject(forKey: "url") as? String
+        id = aDecoder.decodeObject(forKey: "id") as? Int
+        productId = aDecoder.decodeObject(forKey: "product_id") as? String
+        rule = aDecoder.decodeObject(forKey: "rule") as? CMSRuleModel
+        showType = aDecoder.decodeObject(forKey: "show_type") as? Int
+        subjectId = aDecoder.decodeObject(forKey: "subject_id") as? String
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if linkType != nil{
+            aCoder.encode(linkType, forKey: "link_type")
+        }
+        if linkUrl != nil{
+            aCoder.encode(linkUrl, forKey: "link_url")
+        }
+        if showNum != nil{
+            aCoder.encode(showNum, forKey: "show_num")
+        }
+        if title != nil{
+            aCoder.encode(title, forKey: "title")
+        }
+        if url != nil{
+            aCoder.encode(url, forKey: "url")
+        }
+        if id != nil{
+            aCoder.encode(id, forKey: "id")
+        }
+        if productId != nil{
+            aCoder.encode(productId, forKey: "product_id")
+        }
+        if rule != nil{
+            aCoder.encode(rule, forKey: "rule")
+        }
+        if showType != nil{
+            aCoder.encode(showType, forKey: "show_type")
+        }
+        if subjectId != nil{
+            aCoder.encode(subjectId, forKey: "subject_id")
+        }
+        
+    }
+    
+}
+

+ 54 - 0
RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSTemplateModel.swift

@@ -0,0 +1,54 @@
+//
+//	CMSTemplateModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+
+class CMSTemplateModel : NSObject, NSCoding, Mappable{
+
+	var applyType : Int?
+	var title : String?
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return CMSTemplateModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		applyType <- map["apply_type"]
+		title <- map["title"]
+		
+	}
+
+    /**
+    * NSCoding required initializer.
+    * Fills the data from the passed decoder
+    */
+    @objc required init(coder aDecoder: NSCoder)
+	{
+         applyType = aDecoder.decodeObject(forKey: "apply_type") as? Int
+         title = aDecoder.decodeObject(forKey: "title") as? String
+
+	}
+
+    /**
+    * NSCoding required method.
+    * Encodes mode properties into the decoder
+    */
+    @objc func encode(with aCoder: NSCoder)
+	{
+		if applyType != nil{
+			aCoder.encode(applyType, forKey: "apply_type")
+		}
+		if title != nil{
+			aCoder.encode(title, forKey: "title")
+		}
+
+	}
+
+}

+ 13 - 0
RainbowPlanet/RainbowPlanet/Service/Model/CommonModel/CommondModel.swift

@@ -0,0 +1,13 @@
+//
+//  CommondModel.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/5/7.
+//  Copyright © 2019 南鑫林. All rights reserved.
+//
+
+import UIKit
+
+class CommondModel: NSObject {
+
+}

+ 6 - 6
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift

@@ -31,10 +31,10 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
         parameters.updateValue(baiduToCityModel.areaCode, forKey: "city_id")
         SwiftProgressHUD.shared().showWait()
-        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetTemplateName(parameters: parameters))) {
-            (data) in
+        SwiftMoyaNetWorkManager.shared().requestArray(CMSTemplateModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetTemplateName(parameters: parameters))) {
+            (cmsTemplateModels) in
             SwiftProgressHUD.shared().hide()
-            completion(data)
+            completion(cmsTemplateModels)
         }
     }
     
@@ -48,10 +48,10 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
         parameters.updateValue(baiduToCityModel.areaCode, forKey: "city_id")
         parameters.updateValue(type, forKey: "type")
-        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetPreview(parameters: parameters))) {
-            (data) in
+        SwiftMoyaNetWorkManager.shared().request(CMSModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetPreview(parameters: parameters))) {
+            (cmsModel) in
             SwiftProgressHUD.shared().hide()
-            completion(data)
+            completion(cmsModel)
         }
     }
     

+ 79 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift

@@ -107,6 +107,8 @@ public class SwiftMoyaNetWorkManager: NSObject {
     typealias successCallback = (_ data: Any) -> Void
     /// 成功回调带泛型
     typealias successCallTBack = (_ T: BaseMappable) -> Void
+    
+    typealias successCallArrayTback = (_ T: [BaseMappable]) -> Void
 
     typealias falseCallback = () -> Void
     var falseCallback : falseCallback?
@@ -148,6 +150,44 @@ public class SwiftMoyaNetWorkManager: NSObject {
             }
             .disposed(by: disposeBag)
     }
+    
+    /// 网络请求
+    ///
+    /// - Parameters:
+    ///   - type: 模型
+    ///   - target: 请求地址加参数
+    ///   - isCache: 是否缓存
+    ///   - completion: 回调
+    func requestArray<T: BaseMappable>(_ type: T.Type ,target: MultiTarget,isCustomAlert:Bool = false,completion: @escaping successCallArrayTback) -> Void {
+        //判断是否链接网络
+        if !isNetworkConnect{
+            SwiftProgressHUD.shared().showError("网络链接失败,请检查网络")
+            return
+        }
+        
+        provider.rx
+            .request(target)
+            .mapArray(T.self)
+            .subscribeOn(ConcurrentDispatchQueueScheduler(qos: .userInitiated))
+            .observeOn(MainScheduler.instance)
+            .subscribe(onSuccess: { [weak self] element in
+                
+                guard let element = element else {
+                    if let falseCallback = self?.falseCallback  {
+                        falseCallback()
+                    }
+                    return
+                }
+                completion(element)
+            }) {
+                [weak self] (error) in
+                if let falseCallback = self?.falseCallback  {
+                    falseCallback()
+                }
+                SwiftProgressHUD.shared().showError("网络链接失败,请检查网络")
+            }
+            .disposed(by: disposeBag)
+    }
 
     /// 缓存请求
     ///
@@ -391,4 +431,43 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
             }
         }
     }
+    
+    func mapArray<T: BaseMappable>(_ type: T.Type) -> Single<[T]?> {
+        return flatMap { response -> Single<[T]?> in
+            do {
+                let json = try JSON(response.mapJSON())
+                if response.statusCode == 200 {
+                    NXLLog("\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
+                    
+                    let json = JSON(parseJSON: json.description)
+                    let rootModel = RootModel(JSONString: json.description)
+                    let data = JSON(json["data"]).description
+                    rootModel?.data = data
+                    if rootModel!.code  == 0 {
+                        let mapper = Mapper<T>().mapArray(JSONString: rootModel!.data!)
+                        return Single<[T]?>.just(mapper)
+                    }else if rootModel!.code  == 1 {
+                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!", textAlignment: .left)
+                        return Single<[T]?>.just(nil)
+                    }else {
+                        return Single<[T]?>.just(nil)
+                    }
+                }else if response.statusCode == 401 {
+                    NXLLog("\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
+                    let infoModel = InfoModel(JSONString: json.description)
+                    SwiftProgressHUD.shared().showText(infoModel!.message ?? "登录过期,请重新登录")
+                    kAppDelegate.setLoginController()
+                    return Single<[T]?>.just(nil)
+                }else {                NXLLog("\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
+                    SwiftProgressHUD.shared().showText(response.description)
+                    return Single<[T]?>.just(nil)
+                }
+                
+            } catch {
+                NXLLog("\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
+                SwiftProgressHUD.shared().showText(response.description)
+                return Single<[T]?>.just(nil)
+            }
+        }
+    }
 }

+ 0 - 23
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "filename" : "home_btn_buy.png",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "home_btn_buy@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "home_btn_buy@3x.png",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/home_btn_buy.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/home_btn_buy@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_btn_buy.imageset/home_btn_buy@3x.png


+ 0 - 23
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "filename" : "home_pic_banner_06.png",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "home_pic_banner_06@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "home_pic_banner_06@3x.png",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/home_pic_banner_06.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/home_pic_banner_06@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/ShoppingMallModule.xcassets/home_pic_banner_06.imageset/home_pic_banner_06@3x.png