南鑫林 5 gadi atpakaļ
vecāks
revīzija
23e30840ef
14 mainītis faili ar 194 papildinājumiem un 225 dzēšanām
  1. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewLayout.swift
  2. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoModel.swift
  3. 7 6
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift
  4. 5 7
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift
  5. 25 28
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift
  6. 8 10
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift
  7. 7 9
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift
  8. 2 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServicePay/SwiftMoyaNetWorkServicePay.swift
  9. 18 20
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift
  10. 1 4
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceSMS/SwiftMoyaNetWorkServiceSMS.swift
  11. 1 3
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceShop/SwiftMoyaNetWorkServiceShop.swift
  12. 33 36
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift
  13. 1 4
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceVirus/SwiftMoyaNetWorkServiceVirus.swift
  14. 84 91
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewLayout.swift

@@ -92,7 +92,7 @@ class CardContentPicVideoCollectionViewLayout: UICollectionViewLayout {
                 if indexPath.row < 2 {
                     return CGRect(x: (CGFloat(indexPath.row) * (kScreenWidth - 29) / 2) + (CGFloat(indexPath.row) * spacing), y: 0, width: (kScreenWidth - 29) / 2, height: (kScreenWidth - 29) / 2)
                 }else {
-                    return CGRect(x: (CGFloat(indexPath.row-2) * (kScreenWidth-30)/3) + (CGFloat(indexPath.row-2) * spacing), y: 115 * kScaleWidth + 1, width: (kScreenWidth-30)/3, height: (kScreenWidth-30)/3)
+                    return CGRect(x: (CGFloat(indexPath.row-2) * (kScreenWidth-30)/3) + (CGFloat(indexPath.row-2) * spacing), y: (kScreenWidth - 29) / 2 + 1, width: (kScreenWidth-30)/3, height: (kScreenWidth-30)/3)
 
                 }
             case 6:

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoModel.swift

@@ -42,7 +42,7 @@ class CardContentPicVideoModel: NSObject {
             case 4:
                 return (kScreenWidth - 30) / 3 + 195 * kScaleWidth + 1
             case 5:
-                return 173.5 * kScaleWidth + (kScreenWidth-30)/3 + 1
+                return (kScreenWidth - 29) / 2 + (kScreenWidth-30)/3 + 1
             case 6:
                 return (kScreenWidth - 30) / 3 * 2 + 1
             case 7:

+ 7 - 6
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -57,6 +57,12 @@ class CommunityRecommendController: BaseViewController {
         view.addSubview(commentView)
         view.addSubview(tableView)
         view.addSubview(sharedButton)
+        
+        tableView.snp.makeConstraints { (make) in
+            make.top.equalToSuperview().offset(kNavBarTotalHeight)
+            make.left.right.equalToSuperview()
+            make.bottom.equalTo(commentView.snp_top).offset(0)
+        }
         emptyView = DIYEmptyView.emptyActionView(withImageStr: "default_page_content", titleStr: nil, detailStr: "内容飞走了, 去看看别的吧", btnTitleStr: "去首页") {
             [weak self] in
             self?.tabBarController?.selectedIndex = 0
@@ -72,6 +78,7 @@ class CommunityRecommendController: BaseViewController {
         emptyView?.actionBtnBackGroundColor = kThemeColor
         self.view.ly_emptyView = emptyView
         self.view.ly_showEmpty()
+        
 
     }
     
@@ -99,11 +106,6 @@ class CommunityRecommendController: BaseViewController {
             make.height.equalTo(48+kSafeTabBarHeight)
             make.bottom.equalToSuperview()
         }
-        tableView.snp.makeConstraints { (make) in
-            make.top.equalToSuperview().offset(kNavBarTotalHeight)
-            make.left.right.equalToSuperview()
-            make.bottom.equalTo(commentView.snp_top).offset(0)
-        }
         sharedButton.snp.makeConstraints { (make) in
             make.bottom.equalTo(commentView.snp_top).offset(-20)
             make.height.equalTo(71)
@@ -194,7 +196,6 @@ class CommunityRecommendController: BaseViewController {
         sharedButton.rx.tap.subscribe(onNext: { [weak self] _ in
             self?.share()
         }).disposed(by: disposeBag)
-        
         tableView.addHeader(withBeginRefresh: true, animation: true) {
             [weak self] (page) in
             self?.communityPostDetailApi()

+ 5 - 7
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift

@@ -20,8 +20,6 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     class func shared() -> SwiftMoyaNetWorkServiceCMS {
         return _sharedInstance
     }
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
     
     /// 数据回调
     typealias apiFalseCallBack = () -> (Void)
@@ -29,7 +27,7 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     /// 获取模板名称
     ///
     /// - Parameter completion: 完成
-    func cmsTemplateSetTemplateNameApi(completion: @escaping apiCallBack) {
+    func cmsTemplateSetTemplateNameApi(completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         let loacationModel = LocationModel.shared().object()
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
@@ -43,7 +41,7 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     /// 获取首页
     ///
     /// - Parameter completion: 完成
-    func cmsTemplateSetPreviewApi(type:Int,completion: @escaping apiCallBack) {
+    func cmsTemplateSetPreviewApi(type:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         let loacationModel = LocationModel.shared().object()
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
@@ -58,7 +56,7 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     /// 获取商品列表
     ///
     /// - Parameter completion: 完成
-    func cmsTemplateSetProductListApi(subjectId:String = "",completion: @escaping apiCallBack) {
+    func cmsTemplateSetProductListApi(subjectId:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(subjectId, forKey: "subject_id")
         SwiftMoyaNetWorkManager.shared.requestArrayObject(ProductSearchModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetProductList(parameters: parameters))) {
@@ -72,7 +70,7 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     /// - Parameters:
     ///   - take_count: take_count
     ///   - completion: completion description
-    func cmsMemberListApi(takeCount:Int = 0,completion: @escaping apiCallBack) {
+    func cmsMemberListApi(takeCount:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
 
         parameters.updateValue(takeCount, forKey: "take_count")
@@ -87,7 +85,7 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func cmsTemplateExchangeApi(completion: @escaping apiCallBack) {
+    func cmsTemplateExchangeApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         SwiftMoyaNetWorkManager.shared.requestObject(CMSRedemptionAreaModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateExchange(parameters: parameters))) {
             (cmsRedemptionAreaModel) in

+ 25 - 28
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift

@@ -21,16 +21,13 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         return sharedInstance
     }
     
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
-    
     // MARK: - 话题组列表
     /// 话题组列表
     ///
     /// - Parameters:
     ///   - isSuggest: 是否推荐
     ///   - completion: 回调
-    func communityTopicCategoryApi(isSuggest:Int = 0,page:Int = 1,completion: @escaping apiCallBack) {
+    func communityTopicCategoryApi(isSuggest:Int = 0,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(isSuggest, forKey: "is_suggest")
         parameters.updateValue(page, forKey: "page")
@@ -45,7 +42,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - topic_group_ids: 话题组
     ///   - completion: 回调
-    func communityMemberFollowTopicApi(topicGroupIds:String = "",completion: @escaping apiCallBack) {
+    func communityMemberFollowTopicApi(topicGroupIds:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(topicGroupIds, forKey: "topic_group_ids")
         SwiftMoyaNetWorkManager.shared.requestAny(target: MultiTarget(SwiftMoyaServiceCommunityApi.communityMemberFollowTopic(parameters: parameters))) { (data) in
@@ -59,7 +56,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - type: 个人中心内容类别
     ///   - completion: 回调
-    func communityPostMyApi(type:CommunityPostMyType,uid:Int,page:Int = 1,completion: @escaping apiCallBack) {
+    func communityPostMyApi(type:CommunityPostMyType,uid:Int,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(type.rawValue, forKey: "type")
         parameters.updateValue(uid, forKey: "uid")
@@ -78,7 +75,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - name: 关键字
     ///   - page: 分页
     ///   - completion: 回调
-    func communityTopicsApi(categoryId:Int = 0, isSuggest:Int = 0,name:String = "",page:Int = 1,completion: @escaping apiCallBack) {
+    func communityTopicsApi(categoryId:Int = 0, isSuggest:Int = 0,name:String = "",page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(isSuggest, forKey: "is_suggest")
         parameters.updateValue(categoryId, forKey: "category_id")
@@ -98,7 +95,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - keyword: 关键字搜索:标题,内容
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPostsApi(keyword:String = "",topicIds : String = "",page:Int = 1,completion: @escaping apiCallBack) {
+    func communityPostsApi(keyword:String = "",topicIds : String = "",page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(keyword, forKey: "keyword")
         parameters.updateValue(topicIds, forKey: "topic_ids")
@@ -124,7 +121,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - imgs: 图集,type为image是必填,json字符串
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPublishApi(type:String = "", img:String = "", topic_ids:String = "", video:String = "", title:String = "", content:String = "", location:String = "", imgs:String = "", completion: @escaping apiCallBack) {
+    func communityPublishApi(type:String = "", img:String = "", topic_ids:String = "", video:String = "", title:String = "", content:String = "", location:String = "", imgs:String = "", completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(type, forKey: "type")
         parameters.updateValue(img, forKey: "img")
@@ -146,7 +143,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///
     /// - Parameters:
     ///   - postId: 帖子Id
-    func communityDeleteApi(postId:Int, completion: @escaping apiCallBack) {
+    func communityDeleteApi(postId:Int, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(postId, forKey: "id")
         
@@ -165,7 +162,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - filename: 视频名称(必须带扩展名)
     ///   - cover_url: 封面图,自定义视频封面URL地址
     ///   - completion: 回调
-    func communityVideoUploadAuthApi(title:String = "", filename:String = "", cover_url:String = "", completion: @escaping apiCallBack) {
+    func communityVideoUploadAuthApi(title:String = "", filename:String = "", cover_url:String = "", completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(title, forKey: "title")
         parameters.updateValue(filename, forKey: "filename")
@@ -181,7 +178,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func communityImageUploadAuth(completion: @escaping apiCallBack) {
+    func communityImageUploadAuth(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         
@@ -196,7 +193,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///
     /// - Parameters:
     ///   - id: 内容id(过滤用)
-    func communityVideoListApi(id:Int = 0, page:Int = 1, completion: @escaping apiCallBack) {
+    func communityVideoListApi(id:Int = 0, page:Int = 1, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         parameters.updateValue(page, forKey: "page")
@@ -216,7 +213,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - url: 音乐路径
     ///   - uid: 用户ID
     ///   - completion: 回调
-    func communityUploadMusicApi(name:String = "", username:String = "", url:String = "", uid:Int = 0, completion: @escaping apiCallBack) {
+    func communityUploadMusicApi(name:String = "", username:String = "", url:String = "", uid:Int = 0, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(name, forKey: "name")
         parameters.updateValue(username, forKey: "username")
@@ -238,7 +235,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - page: 分页
     ///   - completion: 回调
-    func communityRecMusicListApi(page:Int = 1,completion: @escaping apiCallBack) {
+    func communityRecMusicListApi(page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         
@@ -254,7 +251,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - page: 分页
     ///   - completion: 回调
-    func communityGetMusicCategoryApi(completion: @escaping apiCallBack) {
+    func communityGetMusicCategoryApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(CommunityMusicCategoryListModel.self, target: MultiTarget(SwiftMoyaServiceCommunityApi.communityGetMusicCategory(parameters: parameters))) { (communityMusicCategoryListModel) in
@@ -270,7 +267,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - category_id: 分类ID
     ///   - page: 分页
     ///   - completion: 回调
-    func communityCateMusicListApi(categoryID:Int = 0, page:Int = 1, completion: @escaping apiCallBack) {
+    func communityCateMusicListApi(categoryID:Int = 0, page:Int = 1, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(categoryID, forKey: "category_id")
         parameters.updateValue(page, forKey: "page")
@@ -287,7 +284,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - page: 多关注页面feed流
     ///   - completion: 回调
-    func communityFollowFeedApi(page:Int = 1,completion: @escaping apiCallBack) {
+    func communityFollowFeedApi(page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         SwiftMoyaNetWorkManager.shared.requestObject(CommunityFollowFeedModel.self, target: MultiTarget(SwiftMoyaServiceCommunityApi.communityFollowFeed(parameters: parameters))) {  (communityFollowFeedModel) in
@@ -303,7 +300,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - page: 多关注页面feed流
     ///   - completion: completion description
-    func communityPostSuggestApi(page:Int = 1,completion: @escaping apiCallBack) {
+    func communityPostSuggestApi(page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         
@@ -319,7 +316,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - id: 话题Id
     ///   - completion: 回调
-    func communityTopicDetailApi(id:Int,completion: @escaping apiCallBack) {
+    func communityTopicDetailApi(id:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -336,7 +333,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - id: 话题Id
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPostTopicApi(id:Int,page:Int = 1,completion: @escaping apiCallBack) {
+    func communityPostTopicApi(id:Int,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         parameters.updateValue(id, forKey: "id")
@@ -354,7 +351,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - name: 话题名字
     ///   - page: 分页
     ///   - completion: 回调
-    func communityMemberFollowTopicListApi(name:String = "",page:Int = 1,completion: @escaping apiCallBack) {
+    func communityMemberFollowTopicListApi(name:String = "",page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         parameters.updateValue(name, forKey: "name")
@@ -371,7 +368,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - topicId: 话题Id
     ///   - completion: 回调
-    func communityMemberFollowTopicFollowApi(topicId:Int,completion: @escaping apiCallBack) {
+    func communityMemberFollowTopicFollowApi(topicId:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(topicId, forKey: "topic_id")
         
@@ -387,7 +384,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - topicId: 话题Id
     ///   - completion: 回调
-    func communityMemberFollowTopicCancelFollowApi(topicId:Int,completion: @escaping apiCallBack) {
+    func communityMemberFollowTopicCancelFollowApi(topicId:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(topicId, forKey: "topic_id")
         
@@ -404,7 +401,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     /// - Parameters:
     ///   - id: 内容id
     ///   - completion: 回调
-    func communityPostDetailApi(id:Int,completion: @escaping apiCallBack) {
+    func communityPostDetailApi(id:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -422,7 +419,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - postId: 内容id
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPostCommentsApi(postId:Int,page:Int = 1,completion: @escaping apiCallBack) {
+    func communityPostCommentsApi(postId:Int,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(postId, forKey: "post_id")
         parameters.updateValue(page, forKey: "page")
@@ -441,7 +438,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - postId: 内容id
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPostReplyApi(postId:Int,page:Int = 1,completion: @escaping apiCallBack) {
+    func communityPostReplyApi(postId:Int,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(postId, forKey: "id")
         parameters.updateValue(page, forKey: "page")
@@ -459,7 +456,7 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
     ///   - postId: 内容id
     ///   - page: 分页
     ///   - completion: 回调
-    func communityPostCommentApi(communityCustomCommnetModel:CommunityCustomCommnetModel,completion: @escaping apiCallBack) {
+    func communityPostCommentApi(communityCustomCommnetModel:CommunityCustomCommnetModel,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters = communityCustomCommnetModel.toJSON()
         

+ 8 - 10
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift

@@ -19,13 +19,11 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     class func shared() -> SwiftMoyaNetWorkServiceConfig {
         return _sharedInstance
     }
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
     
     /// 前端config配置
     ///
     /// - Parameter completion: 回调
-    func configApi(completion: @escaping apiCallBack) {
+    func configApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
 //
         SwiftMoyaNetWorkManager.shared.requestObject(ConfigModel.self,target: MultiTarget(SwiftMoyaServiceConfigApi.configConfig(parameters: parameters))) {(configModel) in
@@ -42,7 +40,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     ///   - latitude: 纬度
     ///   - page: 页数
     ///   - completion: 完成
-    func configPickupNodeIndexApi(longitude:String?,latitude:String?, page:Int = 1,completion: @escaping apiCallBack) {
+    func configPickupNodeIndexApi(longitude:String?,latitude:String?, page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         let loacationModel = LocationModel.shared().object()
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
@@ -64,7 +62,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     ///   - city_id: 城市Id
     ///   - page: 页数
     ///   - completion: 完成
-    func configCityManagementIndexApi(page:Int = 1,completion: @escaping apiCallBack) {
+    func configCityManagementIndexApi(page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         let loacationModel = LocationModel.shared().object()
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
@@ -85,7 +83,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     /// - Parameters:
     ///   - imageArray: 图片数据
     ///   - completion: null
-    func configUploadSingleImgApi(imageArray:Array<UIImage>, completion: @escaping apiCallBack) {
+    func configUploadSingleImgApi(imageArray:Array<UIImage>, completion: @escaping successCallBack) {
         
         var  multipartData = Array<Any>()
         let  parameters = Dictionary<String,Any>()
@@ -110,7 +108,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     /// - Parameters:
     ///   - imageArray: 图片数据
     ///   - completion: null
-    func configUploadSingleImgWithoutHudApi(imageArray:Array<UIImage>, completion: @escaping apiCallBack) {
+    func configUploadSingleImgWithoutHudApi(imageArray:Array<UIImage>, completion: @escaping successCallBack) {
         
         var  multipartData = Array<Any>()
         let  parameters = Dictionary<String,Any>()
@@ -133,7 +131,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     /// - Parameters:
     ///   - imageArray: 图片数据
     ///   - completion: null
-    func configUploadMultiImgApi(imageArray:Array<UIImage>, completion: @escaping apiCallBack) {
+    func configUploadMultiImgApi(imageArray:Array<UIImage>, completion: @escaping successCallBack) {
         
         var  multipartData = Array<Any>()
         let  parameters = Dictionary<String,Any>()
@@ -152,7 +150,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     }
     
     // MARK: 邀请海报
-    func configPosterInviteApi(completion: @escaping apiCallBack) {
+    func configPosterInviteApi(completion: @escaping successCallBack) {
         let  parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestAny(target: MultiTarget(SwiftMoyaServiceConfigApi.configPosterInvite(parameters: parameters))) { (data) in
@@ -165,7 +163,7 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     /// 系统升级接口
     ///
     /// - Parameter completion: <#completion description#>
-    func configUpGradeApi(completion: @escaping apiCallBack) {
+    func configUpGradeApi(completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue("ios", forKey: "os")
         parameters.updateValue(AppInfo.clientBuildVersion, forKey: "version_code")

+ 7 - 9
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift

@@ -19,15 +19,13 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     class func shared() -> SwiftMoyaNetWorkServiceOrder {
         return _sharedInstance
     }
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
     
     // MARK: - 创建订单
     /// 创建订单
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func orderCreateApi(paraMdl:OrderCreateParameterModel, completion: @escaping apiCallBack) {
+    func orderCreateApi(paraMdl:OrderCreateParameterModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         
         // 本地获取city_id/city_name
@@ -79,7 +77,7 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     /// - Parameters:
     ///   - status: 订单状态
     ///   - completion: 回调
-    func orderPurchaseOrderListApi(page:Int = 1,status:Int = -1,completion: @escaping apiCallBack) {
+    func orderPurchaseOrderListApi(page:Int = 1,status:Int = -1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         
         if status == -1 {
@@ -116,7 +114,7 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     /// - Parameters:
     ///   - status: 订单状态
     ///   - completion: 回调
-    func orderPurchaseDetailApi(purchaseNo:String = "",completion: @escaping apiCallBack) {
+    func orderPurchaseDetailApi(purchaseNo:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(purchaseNo, forKey: "purchase_no")
         
@@ -132,7 +130,7 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     /// - Parameters:
     ///   - refundNo: <#refundNo description#>
     ///   - completion: <#completion description#>
-    func orderPurchaseRefundDetailApi(refundNo:String = "",completion: @escaping apiCallBack) {
+    func orderPurchaseRefundDetailApi(refundNo:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(refundNo, forKey: "refund_no")
         
@@ -153,7 +151,7 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     ///   - detail: 子订单id(json字符串
     ///   - imgs: 图库(json字符串)
     ///   - completion: 回调
-    func orderPurchaseRefundApi(purchaseId:Int = 0,mobile:String = "",refundReason:String = "",refund_remark:String = "",detail:String = "",imgs:String = "",completion: @escaping apiCallBack) {
+    func orderPurchaseRefundApi(purchaseId:Int = 0,mobile:String = "",refundReason:String = "",refund_remark:String = "",detail:String = "",imgs:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(purchaseId, forKey: "purchase_id")
         parameters.updateValue(mobile, forKey: "mobile")
@@ -174,7 +172,7 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     /// - Parameters:
     ///   - purchaseId: 订单编号
     ///   - completion: 回调
-    func orderPurchaseConfirmApi(purchaseId:Int = 0,completion: @escaping apiCallBack) {
+    func orderPurchaseConfirmApi(purchaseId:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(purchaseId, forKey: "purchase_id")
         
@@ -190,7 +188,7 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     /// - Parameters:
     ///   - patchNumN: 批次号
     ///   - completion: 回调
-    func orderPurchaseCloseApi(patchNum:String = "",completion: @escaping apiCallBack) {
+    func orderPurchaseCloseApi(patchNum:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(patchNum, forKey: "patch_num")
         

+ 2 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServicePay/SwiftMoyaNetWorkServicePay.swift

@@ -20,14 +20,11 @@ public class SwiftMoyaNetWorkServicePay: NSObject {
         return _sharedInstance
     }
 
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
-
     /// 支付
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func payAlipayApi(paraMdl:OrderCreateBackModel, completion: @escaping apiCallBack) {
+    func payAlipayApi(paraMdl:OrderCreateBackModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(paraMdl.patchNum ?? 0, forKey: "patch_num")
         parameters.updateValue(paraMdl.money ?? 0, forKey: "money")
@@ -41,7 +38,7 @@ public class SwiftMoyaNetWorkServicePay: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func payWeixinpayApi(paraMdl:OrderCreateBackModel, completion: @escaping apiCallBack) {
+    func payWeixinpayApi(paraMdl:OrderCreateBackModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(paraMdl.patchNum ?? 0, forKey: "patch_num")
         parameters.updateValue(paraMdl.money ?? 0, forKey: "money")

+ 18 - 20
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift

@@ -19,8 +19,6 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     class func shared() -> SwiftMoyaNetWorkServiceProduct {
         return _sharedInstance
     }
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
     
     // MARK: - 搜索、列表
     /// 搜索、列表
@@ -31,7 +29,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///   - field_order: 1销量 2价格
     ///   - desc: 排序方式:1 desc倒序、2 asc正序
     ///   - completion: 回调
-    func productListApi(page:Int = 1,shopId:Int  = 0, keyword:String = "",categoryId:Int = 0,desc:Int = 0,fieldOrder:Int = 0,completion: @escaping apiCallBack) {
+    func productListApi(page:Int = 1,shopId:Int  = 0, keyword:String = "",categoryId:Int = 0,desc:Int = 0,fieldOrder:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         // 本地获取city_id
         let loacationModel = LocationModel.shared().object()
@@ -80,7 +78,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - parentId: 分类父id
     ///   - completion: 回调
-    func productCategoryApi(page:Int = 1,parentId:Int = 0,completion: @escaping apiCallBack) {
+    func productCategoryApi(page:Int = 1,parentId:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(parentId, forKey: "parent_id")
         parameters.updateValue(page, forKey: "page")
@@ -99,13 +97,13 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - ids:
     ///   - completion: 回调
-    func productHomeProductApi(ids:String = "",completion: @escaping apiCallBack) {
+    func productHomeProductApi(ids:String = "",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(ids, forKey: "ids")
         SwiftMoyaNetWorkManager.shared.requestArrayObject(ProductModel.self, target: MultiTarget(SwiftMoyaServiceProductApi.productHomeProduct(parameters: parameters))) { (productModels) in
             completion(productModels)
         }
-        SwiftMoyaNetWorkManager.shared.falseCallback = {
+        SwiftMoyaNetWorkManager.shared.failCallback = { (loadingStatus) in
             completion("")
         }
     }
@@ -116,7 +114,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - ids:
     ///   - completion: 回调
-    func productDetailApi(id:Int = 0,completion: @escaping apiCallBack) {
+    func productDetailApi(id:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -131,7 +129,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func productHotSaleApi(page:Int = 1, completion: @escaping apiCallBack) {
+    func productHotSaleApi(page:Int = 1, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         // 本地获取city_id
@@ -156,7 +154,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - productId: 商品id
     ///   - completion: 回调
-    func productCommentListApi(page:Int = 1,productId:Int = 0, completion: @escaping apiCallBack) {
+    func productCommentListApi(page:Int = 1,productId:Int = 0, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(productId, forKey: "product_id")
         parameters.updateValue(page, forKey: "page")
@@ -170,7 +168,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func productCartListApi(completion: @escaping apiCallBack) {
+    func productCartListApi(completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         // 本地获取city_id
         let loacationModel = LocationModel.shared().object()
@@ -194,7 +192,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - productMdl: 商品Model
     ///   - completion: 回调
-    func productCartAddApi(productMdl:ProductModel, completion: @escaping apiCallBack) {
+    func productCartAddApi(productMdl:ProductModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         
         parameters.updateValue(productMdl.shopId ?? 0, forKey: "shop_id")
@@ -231,7 +229,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - productMdl: 商品Model
     ///   - completion: 回调
-    func productCartListAddApi(productSearchModel:ProductSearchModel, completion: @escaping apiCallBack) {
+    func productCartListAddApi(productSearchModel:ProductSearchModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         
         
@@ -269,7 +267,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - productMdl: 商品Model
     ///   - completion: 回调
-    func productDetailAddCartApi(productDetailModel:ProductDetailModel,productDetailSkuModel:ProductDetailSkuModel, completion: @escaping apiCallBack) {
+    func productDetailAddCartApi(productDetailModel:ProductDetailModel,productDetailSkuModel:ProductDetailSkuModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         
         parameters.updateValue(productDetailModel.shopId ?? "", forKey: "shop_id")
@@ -307,7 +305,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - id: 购物车id
     ///   - completion: 回调
-    func productCartDeleteApi(id:Int = 0, completion: @escaping apiCallBack) {
+    func productCartDeleteApi(id:Int = 0, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -327,7 +325,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///   - id: 购物车id
     ///   - type: 1-增加,2-减少
     ///   - completion: 回调
-    func productCartAmountApi(id:Int = 0, type:Int = 0, completion: @escaping apiCallBack) {
+    func productCartAmountApi(id:Int = 0, type:Int = 0, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         parameters.updateValue(type, forKey: "type")
@@ -347,7 +345,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///   - shop_id: 商户id
     ///   - isSelect: 1-选中,0-未选中
     ///   - completion: 回调
-    func productCartIsSelApi(id:Int = 0, shop_id:Int = 0, isSelect:Int = 0, completion: @escaping apiCallBack) {
+    func productCartIsSelApi(id:Int = 0, shop_id:Int = 0, isSelect:Int = 0, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         parameters.updateValue(shop_id, forKey: "shop_id")
@@ -372,7 +370,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     /// - Parameters:
     ///   - isSelect: 1-选中,0-未选中
     ///   - completion: 回调
-    func productCartAllSelApi(isSelect:Int = 0, completion: @escaping apiCallBack) {
+    func productCartAllSelApi(isSelect:Int = 0, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(isSelect, forKey: "is_select")
         // 本地获取city_id
@@ -397,7 +395,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///
     /// - Parameters:    
     ///   - completion: 回调
-    func productRefundReasonApi(completion: @escaping apiCallBack) {
+    func productRefundReasonApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(ProductRefundReasonModel.self, target: MultiTarget(SwiftMoyaServiceProductApi.productRefundReason(parameters: parameters))) { (refundReasonModel) in
@@ -411,7 +409,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func productAddCommentApi(paraMdl:OrderCommentParameterModel, completion: @escaping apiCallBack) {
+    func productAddCommentApi(paraMdl:OrderCommentParameterModel, completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(paraMdl.purchase_id ?? 0, forKey: "purchase_id")
         parameters.updateValue(paraMdl.username ?? "", forKey: "username")
@@ -453,7 +451,7 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func productGetCartCountApi(completion: @escaping apiCallBack) {
+    func productGetCartCountApi(completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         
         // 本地获取city_id

+ 1 - 4
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceSMS/SwiftMoyaNetWorkServiceSMS.swift

@@ -21,16 +21,13 @@ class SwiftMoyaNetWorkServiceSMS: NSObject {
         return _sharedInstance
     }
 
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
-
     /// 登录
     ///
     /// - Parameters:
     ///   - mobile: 电话号码
     ///   - password: 用户密码
     ///   - completion: 回调
-    func smsSendSMSApi(mobile:String,appNameType:AppNameType,sendType:SendType,smsType:SMSType,completion: @escaping apiCallBack) {
+    func smsSendSMSApi(mobile:String,appNameType:AppNameType,sendType:SendType,smsType:SMSType,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(mobile, forKey: "mobile")
         parameters.updateValue(appNameType, forKey: "app_name")

+ 1 - 3
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceShop/SwiftMoyaNetWorkServiceShop.swift

@@ -18,8 +18,6 @@ class SwiftMoyaNetWorkServiceShop: NSObject {
     class func shared() -> SwiftMoyaNetWorkServiceShop {
         return _sharedInstance
     }
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
     
     // MARK: - 获取商家信息
     /// 获取商家信息
@@ -27,7 +25,7 @@ class SwiftMoyaNetWorkServiceShop: NSObject {
     /// - Parameters:
     ///   - shopId: 商家id
     ///   - completion: 回调
-    func shopViewApi(shopId:Int = 0 ,completion: @escaping apiCallBack) {
+    func shopViewApi(shopId:Int = 0 ,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(shopId, forKey: "id")
         SwiftMoyaNetWorkManager.shared.requestObject(ShopModel.self,target: MultiTarget(SwiftMoyaServiceShopApi.shopView(parameters: parameters))) {

+ 33 - 36
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

@@ -20,9 +20,6 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     public class func shared() -> SwiftMoyaNetWorkServiceUser {
         return sharedInstance
     }
-    
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
 
     // MARK: - 微信注册/登录
     /// 微信注册/登录
@@ -34,7 +31,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - username: 昵称
     ///   - gender: 性别 1男 2女
     ///   - completion: 回调
-    func userWeiXinRegisterApi(open_id:String,union_id:String,avatar:String,username:String,gender:Int,completion: @escaping apiCallBack) {
+    func userWeiXinRegisterApi(open_id:String,union_id:String,avatar:String,username:String,gender:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(open_id, forKey: "open_id")
         parameters.updateValue(union_id, forKey: "union_id")
@@ -56,7 +53,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - mobile: 手机号
     ///   - sms_code: 短信验证码
     ///   - completion: 回调
-    func userMobileRegisterApi(mobile:String,sms_code:String,invitationCode:String,completion: @escaping apiCallBack) {
+    func userMobileRegisterApi(mobile:String,sms_code:String,invitationCode:String,completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: mobile) {
             var parameters = Dictionary<String,Any>()
@@ -80,7 +77,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - mobile: 手机号
     ///   - password: 密码
     ///   - completion: 回调
-    func userMobileLoginApi(mobile:String,password:String,completion: @escaping apiCallBack) {
+    func userMobileLoginApi(mobile:String,password:String,completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: mobile) {
             var parameters = Dictionary<String,Any>()
@@ -100,7 +97,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///
     /// - Parameters:
     ///   - completion: 回调
-    func userRefreshApi(completion: @escaping apiCallBack) {
+    func userRefreshApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(UserModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userRefresh(parameters: parameters))) { (userModel) in
@@ -132,7 +129,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - unionId: 微信unioId
     ///   - openId: 微信openId
     ///   - completion: 回调
-    func userBindMobileApi(mobile:String,smsCode:String,unionId:String,openId:String,invitationCode:String,completion: @escaping apiCallBack) {
+    func userBindMobileApi(mobile:String,smsCode:String,unionId:String,openId:String,invitationCode:String,completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: mobile) {
             var parameters = Dictionary<String,Any>()
@@ -157,7 +154,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - umLoginModel: UMLoginModel
     ///   - completion: 回调
-    func userIsBindWeixinBindApi(umLoginModel:UMLoginModel,completion: @escaping apiCallBack) {
+    func userIsBindWeixinBindApi(umLoginModel:UMLoginModel,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(umLoginModel.union_id, forKey: "union_id")
         parameters.updateValue(umLoginModel.open_id, forKey: "open_id")
@@ -197,7 +194,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - mobile: 手机号
     ///   - umLoginModel: 微信模型
     ///   - completion: 回调
-    func userBindWeixinApi(mobile:String,umLoginModel:UMLoginModel,completion: @escaping apiCallBack) {
+    func userBindWeixinApi(mobile:String,umLoginModel:UMLoginModel,completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: mobile) {
             var parameters = Dictionary<String,Any>()
@@ -225,7 +222,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - unionId: 微信unionId
     ///   - openId: 微信openId
     ///   - completion: 回调
-    func userUnbindWeixinApi(completion: @escaping apiCallBack) {
+    func userUnbindWeixinApi(completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         let userModel = UserModel.shared().getModel()
         parameters.updateValue(userModel!.unionId! as Any, forKey: "union_id")
@@ -250,7 +247,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - password: 密码
     ///   - password_confirmation: 确认密码
     ///   - completion: 回调
-    func userSetPasswordApi(mobile:String,password:String,password_confirmation:String,completion: @escaping apiCallBack) {
+    func userSetPasswordApi(mobile:String,password:String,password_confirmation:String,completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: mobile) {
             var parameters = Dictionary<String,Any>()
@@ -279,7 +276,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - type: 0所有列表,1自提列表,2快递
     ///   - city_id: 城市id
     ///   - completion: 回调
-    func userSelfAndExpressAddressListApi(type:Int,completion: @escaping apiCallBack) {
+    func userSelfAndExpressAddressListApi(type:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         let loacationModel = LocationModel.shared().object()
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
@@ -308,7 +305,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - address: 详细地址
     ///   - zipcode: 邮政编码 710110
     ///   - completion: 回调
-    func userAddExpressAddressApi(expressAddresModel:ExpressAddresModel, completion: @escaping apiCallBack) {
+    func userAddExpressAddressApi(expressAddresModel:ExpressAddresModel, completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: expressAddresModel.contactMobile ?? "") {
             var parameters = Dictionary<String,Any>()
@@ -340,7 +337,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///
     /// - Parameters:
     ///   - id: 表id 修改适合传
-    func userAddressIsDefaultApi(id:Int = 0,completion: @escaping apiCallBack) {
+    func userAddressIsDefaultApi(id:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -358,7 +355,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///
     /// - Parameters:
     ///   - id: 地址Id
-    func userAddressDeleteApi(id:Int = 0,completion: @escaping apiCallBack) {
+    func userAddressDeleteApi(id:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -375,7 +372,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 自提点收货人列表
     ///
     /// - Parameter completion: 成功回调
-    func userExpreesContactsListApi(completion: @escaping apiCallBack) {
+    func userExpreesContactsListApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(ContactListModel.self, target: MultiTarget(SwiftMoyaServiceUserApi.userExpreesContactsList(parameters: parameters))) { (contactListModel) in
@@ -388,7 +385,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 获取默认快递信息
     ///
     /// - Parameter completion: 成功回调
-    func userDefaultExpressApi(completion: @escaping apiCallBack) {
+    func userDefaultExpressApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(ExpressAddresModel.self, target: MultiTarget(SwiftMoyaServiceUserApi.userDefaultExpress(parameters: parameters))) { (expressAddrModel) in
@@ -401,7 +398,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 获取默认快递信息
     ///
     /// - Parameter completion: 成功回调
-    func userDefaultContactApi(completion: @escaping apiCallBack) {
+    func userDefaultContactApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(SelfMentionContactsModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userDefaultContact(parameters: parameters))) {(contactMdl) in
@@ -418,7 +415,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - mobile: 手机号码
     ///   - name: 用户名
     ///   - completion: 完成
-    func userSaveExpreesContactsApi(id:Int = 0,mobile:String = "",name:String = "",completion: @escaping apiCallBack) {
+    func userSaveExpreesContactsApi(id:Int = 0,mobile:String = "",name:String = "",completion: @escaping successCallBack) {
         
         if isMobileVerification(mobile: mobile) {
             if name.count <= 0 {
@@ -448,7 +445,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - id: 收货人id
     ///   - completion: 完成
-    func userDelExpreesContactsApi(id:Int = 0,completion: @escaping apiCallBack) {
+    func userDelExpreesContactsApi(id:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -467,7 +464,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - id: 收货人id
     ///   - completion: 完成
-    func userSetExpreesContactsDefaultApi(id:Int = 0,completion: @escaping apiCallBack) {
+    func userSetExpreesContactsDefaultApi(id:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         
@@ -487,7 +484,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - pickupNodeId: 自提点id
     ///   - address: 详细地址
     ///   - completion: 完成
-    func userAddSelfAddressApi(cityId:Int = 0,cityName:String = "",pickupNodeId:Int = 0,address:String,completion: @escaping apiCallBack) {
+    func userAddSelfAddressApi(cityId:Int = 0,cityName:String = "",pickupNodeId:Int = 0,address:String,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(cityId, forKey: "city_id")
         parameters.updateValue(cityName, forKey: "city_name")
@@ -509,7 +506,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - deliveryMethodType: 0所有列表,1自提列表,2快递
     ///   - completion: 返回
-    func userSetDeliverTypeApi(deliveryMethodType:String = "2",completion: @escaping apiCallBack) {
+    func userSetDeliverTypeApi(deliveryMethodType:String = "2",completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(deliveryMethodType, forKey: "deliver_type")
         
@@ -532,7 +529,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - gender: 0位置 1男 2女
     ///   - completion: 回调
-    func userGenderApi(gender:Int = 0,completion: @escaping apiCallBack) {
+    func userGenderApi(gender:Int = 0,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(gender, forKey: "gender")
 //
@@ -550,7 +547,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 用户信息详情
     ///
     /// - Parameter completion: 回调UserDetailModel
-    func userMemberDetailApi(uid:Int,completion: @escaping apiCallBack) {
+    func userMemberDetailApi(uid:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(uid, forKey: "uid")
         
@@ -564,7 +561,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 更新用户信息详情
     ///
     /// - Parameter completion: 回调UserDetailModel
-    func userMemberDetailUpDateApi(avatar:String,userName:String,signature:String,completion: @escaping apiCallBack) {
+    func userMemberDetailUpDateApi(avatar:String,userName:String,signature:String,completion: @escaping successCallBack) {
         if avatar == "" {
             SwiftProgressHUD.shared().showText("头像不能为空")
             return
@@ -591,7 +588,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 用户关注列表
     ///
     /// - Parameter completion: 回调UserDetailModel
-    func userFollowsApi(uid:Int,page:Int = 1,completion: @escaping apiCallBack) {
+    func userFollowsApi(uid:Int,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(uid, forKey: "uid")
         parameters.updateValue(page, forKey: "page")
@@ -606,7 +603,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 粉丝列表
     ///
     /// - Parameter completion: 回调UserDetailModel
-    func userFansApi(uid:Int,page:Int = 1,completion: @escaping apiCallBack) {
+    func userFansApi(uid:Int,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         parameters.updateValue(uid, forKey: "uid")
@@ -623,7 +620,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - followUid: 被关注人id
     ///   - completion: 回调
-    func userFollowApi(followUid:Int,completion: @escaping apiCallBack) {
+    func userFollowApi(followUid:Int,completion: @escaping successCallBack) {
     
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(followUid, forKey: "follow_uid")
@@ -643,7 +640,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - followUid: 被取消关注人id
     ///   - completion: 回调
-    func userCancelFollowApi(followUid:Int,completion: @escaping apiCallBack) {
+    func userCancelFollowApi(followUid:Int,completion: @escaping successCallBack) {
         
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(followUid, forKey: "follow_uid")
@@ -661,7 +658,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 用户消息消息首页
     ///
     /// - Parameter completion: 回调
-    func userMemberMessageIndexApi(completion: @escaping apiCallBack) {
+    func userMemberMessageIndexApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         
         SwiftMoyaNetWorkManager.shared.requestObject(MessageIndexModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userMemberMessageIndex(parameters: parameters))) { (messageIndexModel) in
@@ -678,7 +675,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     ///   - messageShowTypes: 活动展示类型 0纯展示;1系统通知消息;2内容消息; 3活动消息; 4话题消息 ;5后台系统消息; 6评论消息; 7回复消息 ;8回复@ 消息;9攒内容消息 ;10收藏内容消息; 11分享内容消息 ;12关注消息
     ///   - page: 分页
     ///   - completion: 回调
-    func userMemberMessageListApi(messageShowTypes:String,page:Int,completion: @escaping apiCallBack) {
+    func userMemberMessageListApi(messageShowTypes:String,page:Int,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(messageShowTypes, forKey: "message_show_types")
         parameters.updateValue(page, forKey: "page")
@@ -694,7 +691,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// - Parameters:
     ///   - messageShowTypes: 活动展示类型 0纯展示;1系统通知消息;2内容消息; 3活动消息; 4话题消息 ;5后台系统消息; 6评论消息; 7回复消息 ;8回复@ 消息;9攒内容消息 ;10收藏内容消息; 11分享内容消息 ;12关注消息
     ///   - completion: 回调
-    func userMemberReadMessageApi(messageShowTypes:String,completion: @escaping apiCallBack) {
+    func userMemberReadMessageApi(messageShowTypes:String,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(messageShowTypes, forKey: "message_show_types")
         
@@ -708,7 +705,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 粉丝列表
     ///
     /// - Parameter completion: 回调UserDetailModel
-    func userMemberSearchMemberApi(userName:String,page:Int = 1,completion: @escaping apiCallBack) {
+    func userMemberSearchMemberApi(userName:String,page:Int = 1,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(page, forKey: "page")
         parameters.updateValue(userName, forKey: "username")
@@ -723,7 +720,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 获取彩虹豆
     ///
     /// - Parameter completion: 回调
-    func userMemberGetTotalBeanApi(completion: @escaping apiCallBack) {
+    func userMemberGetTotalBeanApi(completion: @escaping successCallBack) {
         let parameters = Dictionary<String,Any>()
         SwiftMoyaNetWorkManager.shared.requestObject(TotalBeanModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userMemberGetTotalBean(parameters: parameters))) { (totalBeanModel) in
             completion(totalBeanModel)

+ 1 - 4
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceVirus/SwiftMoyaNetWorkServiceVirus.swift

@@ -20,16 +20,13 @@ class SwiftMoyaNetWorkServiceVirus: NSObject {
         return _sharedInstance
     }
     
-    /// 数据回调
-    typealias apiCallBack = (Any) -> (Void)
-    
     
     /// 生成账本
     ///
     /// - Parameters:
     ///   - virueRecordAddParameterModel: 生成账本摩西
     ///   - completion: completion description
-    func virueRecordAddApi(virueRecordAddParameterModel:VirueRecordAddParameterModel,completion: @escaping apiCallBack) {
+    func virueRecordAddApi(virueRecordAddParameterModel:VirueRecordAddParameterModel,completion: @escaping successCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters = virueRecordAddParameterModel.toJSON()
         NXLLog(parameters.description)

+ 84 - 91
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift

@@ -15,6 +15,25 @@ import RxSwift
 import RxCocoa
 import Result
 
+
+/// 网络请求加载状态
+///
+/// - noNetwork: 无网络
+/// - noData: 无数据
+/// - loading: 加载中
+enum SwiftMoyaNetWorkManagerLoadingStatus {
+    case noNetwork
+    case noData
+    case Loading
+}
+
+/// 数据回调
+typealias successCallBack = (Any) -> (Void)
+/// 失败回调
+typealias failCallback = (_ loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) -> Void
+
+
+
 public class SwiftMoyaNetWorkManager: NSObject {
     
     /// 释放内存
@@ -32,8 +51,8 @@ public class SwiftMoyaNetWorkManager: NSObject {
     /// 成功回调带泛型 对象数组
     typealias successCallArrayObjectback = (_ T: [BaseMappable]) -> Void
     /// 失败回调
-    typealias falseCallback = () -> Void
-    var falseCallback : falseCallback?
+    var failCallback : failCallback?
+
 }
 
 extension SwiftMoyaNetWorkManager {
@@ -64,17 +83,15 @@ extension SwiftMoyaNetWorkManager {
     }
     
     /// 失败回调没有有提示
-    func falseCall() {
-        if let falseCallback = self.falseCallback  {
-            falseCallback()
+    func failCall() {
+        if let failCallback = self.failCallback  {
+            failCallback(.noNetwork)
         }
     }
     
     /// 失败回调有提示
-    func falseCallShowText() {
-        if let falseCallback = self.falseCallback  {
-            falseCallback()
-        }
+    func failCallShowText() {
+        failCall()
         DispatchQueue.main.async {
             SwiftProgressHUD.shared().showText("网络链接失败,请检查网络")
         }
@@ -84,7 +101,7 @@ extension SwiftMoyaNetWorkManager {
     func networkConnect() {
         //判断是否链接网络
         if !isNetworkConnect{
-            falseCall()
+            failCall()
             return
         }
     }
@@ -110,13 +127,13 @@ extension SwiftMoyaNetWorkManager {
             .subscribe(onSuccess: { [weak self] element in
                 
                 guard let element = element else {
-                    self?.falseCall()
+                    self?.failCall()
                     return
                 }
                 completion(element)
             }) {
                 [weak self] (error) in
-                self?.falseCallShowText()
+                self?.failCallShowText()
             }
             .disposed(by: disposeBag)
     }
@@ -139,13 +156,13 @@ extension SwiftMoyaNetWorkManager {
             .subscribe(onSuccess: { [weak self] element in
 
                 guard let element = element else {
-                    self?.falseCall()
+                    self?.failCall()
                     return
                 }
                 completion(element)
             }) {
                 [weak self] (error) in
-                self?.falseCallShowText()
+                self?.failCallShowText()
             }
             .disposed(by: disposeBag)
     }
@@ -166,13 +183,13 @@ extension SwiftMoyaNetWorkManager {
             .observeOn(MainScheduler.instance)
             .subscribe(onSuccess: { [weak self] element in
                 guard let element = element else {
-                    self?.falseCall()
+                    self?.failCall()
                     return
                 }
                 completion(element)
             }) {
                 [weak self] (error) in
-                self?.falseCallShowText()
+                self?.failCallShowText()
             }
             .disposed(by: disposeBag)
     }
@@ -195,13 +212,13 @@ extension SwiftMoyaNetWorkManager {
             .subscribe(onSuccess: { [weak self] element in
 
                 guard let element = element else {
-                    self?.falseCall()
+                    self?.failCall()
                     return
                 }
                 completion(element)
             }) {
                 [weak self] (error) in
-                self?.falseCallShowText()
+                self?.failCallShowText()
             }
             .disposed(by: disposeBag)
     }
@@ -221,52 +238,63 @@ extension SwiftMoyaNetWorkManager {
             .observeOn(MainScheduler.instance)
             .subscribe(onSuccess: { [weak self] element in
                 guard let element = element else {
-                   self?.falseCall()
+                   self?.failCall()
                     return
                 }
                 completion(element)
             }) {
                 [weak self] (error) in
-                self?.falseCallShowText()
+                self?.failCallShowText()
             }
             .disposed(by: disposeBag)
     }
 }
 
+extension PrimitiveSequence {
+    
+    func showFailInfo(rootModel:RootModel) {
+        SwiftProgressHUD.shared().showText(rootModel.msg ?? "信息有误!!!")
+    }
+    
+    func log(response:Response,json:JSON) {
+        NXLLog("\nurl=\(String(describing: response.request!.url!))\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
+    }
+    
+    func logError(response:Response) {
+        NXLLog("\nurl=\(String(describing: response.request!.url!))\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
+        SwiftProgressHUD.shared().showText(response.description)
+    }
+}
+
+
 // MARK: - 泛型
 extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Response {
     
+    
     // MARK: 泛型返回RootModel
     func mapRootModel() -> Single<RootModel?> {
         return flatMap { response -> Single<RootModel?> in
             do {
                 let json = try JSON(response.mapJSON())
                 if response.statusCode == 200 {
-                    NXLLog("\nurl=\(String(describing: response.request!.url!))\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
-                    
+                    self.log(response: response, json: json)
                     let rootModel = RootModel(JSONString: json.description)
                     let data = JSON(json["data"]).description
                     rootModel?.data = data
                     return Single<RootModel?>.just(rootModel)
                 }else if response.statusCode == 401 {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\njson=\n\(json.description)")
-                    let infoModel = InfoModel(JSONString: json.description)
-                    SwiftProgressHUD.shared().showText(infoModel!.message ?? "登录过期,请重新登录")
+                    self.log(response: response, json: json)
                     kAppDelegate.setLoginController()
                     return Single<RootModel?>.just(nil)
                 }else {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
+                    self.logError(response: response)
                     SwiftProgressHUD.shared().showText(response.description)
                     
                     return Single<RootModel?>.just(nil)
                 }
                 
             } catch {
-                let url = String(describing: response.request!.url!)
-                NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)")
-                SwiftProgressHUD.shared().showText(response.description)
+                self.logError(response: response)
                 return Single<RootModel?>.just(nil)
             }
         }
@@ -278,39 +306,30 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
             do {
                 let json = try JSON(response.mapJSON())
                 if response.statusCode == 200 {
-                    NXLLog("\nurl=\(String(describing: response.request!.url!))\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
-                    
+                    self.log(response: response, json: json)
                     let rootModel = RootModel(JSONString: json.description)
                     let data = JSON(json["data"]).description
                     rootModel?.data = data
                     if rootModel!.code  == 0 {
                         return Single<Any?>.just(rootModel?.data as Any)
                     }else if rootModel!.code  == 1 {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<Any?>.just(nil)
                     }else {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<Any?>.just(nil)
                     }
                 }else if response.statusCode == 401 {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\njson=\n\(json.description)")
-                    let infoModel = InfoModel(JSONString: json.description)
-                    SwiftProgressHUD.shared().showText(infoModel!.message ?? "登录过期,请重新登录")
+                    self.log(response: response, json: json)
                     kAppDelegate.setLoginController()
                     return Single<Any?>.just(nil)
                 }else {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
-                    SwiftProgressHUD.shared().showText(response.description)
-                    
+                    self.logError(response: response)
                     return Single<Any?>.just(nil)
                 }
                 
             } catch {
-                let url = String(describing: response.request!.url!)
-                NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)")
-                SwiftProgressHUD.shared().showText(response.description)
+                self.logError(response: response)
                 return Single<Any?>.just(nil)
             }
         }
@@ -322,8 +341,8 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
             do {
                 let json = try JSON(response.mapJSON())
                 if response.statusCode == 200 {
-                    NXLLog("\nurl=\(String(describing: response.request!.url!))\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
-                    
+                    self.log(response: response, json: json)
+
                     let rootModel = RootModel(JSONString: json.description)
                     let data = JSON(json["data"]).description
                     rootModel?.data = data
@@ -332,31 +351,23 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
                         let anys = JSON(parseJSON: rootModel?.data ?? "").arrayObject ?? Array<Any>()
                         return Single<[Any]?>.just(anys)
                     }else if rootModel!.code  == 1 {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<[Any]?>.just(nil)
                     }else {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<[Any]?>.just(nil)
                     }
                 }else if response.statusCode == 401 {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\njson=\n\(json.description)")
-                    let infoModel = InfoModel(JSONString: json.description)
-                    SwiftProgressHUD.shared().showText(infoModel!.message ?? "登录过期,请重新登录")
+                    self.log(response: response, json: json)
                     kAppDelegate.setLoginController()
                     return Single<[Any]?>.just(nil)
                 }else {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
-                    SwiftProgressHUD.shared().showText(response.description)
-                    
+                    self.logError(response: response)
                     return Single<[Any]?>.just(nil)
                 }
                 
             } catch {
-                let url = String(describing: response.request!.url!)
-                NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)")
-                SwiftProgressHUD.shared().showText(response.description)
+                self.logError(response: response)
                 return Single<[Any]?>.just(nil)
             }
         }
@@ -369,7 +380,7 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
             do {
                 let json = try JSON(response.mapJSON())
                 if response.statusCode == 200 {
-                    NXLLog("\nurl=\(String(describing: response.request!.url!))\nstatusCode=\(response.statusCode)\njson=\n\(json.description)");
+                    self.log(response: response, json: json)
                     let rootModel = RootModel(JSONString: json.description)
                     let data = JSON(json["data"]).description
                     rootModel?.data = data
@@ -378,31 +389,23 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
                         let mapper = T(JSONString:  rootModel!.data ?? "")
                         return Single<T?>.just(mapper)
                     }else if rootModel!.code  == 1 {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<T?>.just(nil)
                     }else {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<T?>.just(nil)
                     }
                 }else if response.statusCode == 401 {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\njson=\n\(json.description)")
-                    let infoModel = InfoModel(JSONString: json.description)
-                    SwiftProgressHUD.shared().showText(infoModel!.message ?? "登录过期,请重新登录")
+                    self.log(response: response, json: json)
                     kAppDelegate.setLoginController()
                     return Single<T?>.just(nil)
                 }else {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
-                    SwiftProgressHUD.shared().showText(response.description)
-
+                    self.logError(response: response)
                     return Single<T?>.just(nil)
                 }
 
             } catch {
-                let url = String(describing: response.request!.url!)
-                NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)")
-                SwiftProgressHUD.shared().showText(response.description)
+                self.logError(response: response)
                 return Single<T?>.just(nil)
             }
         }
@@ -414,10 +417,7 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
             do {
                 let json = try JSON(response.mapJSON())
                 if response.statusCode == 200 {
-                    
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\njson=\n\(json.description)")
-
+                    self.log(response: response, json: json)
                     let rootModel = RootModel(JSONString: json.description)
                     let data = JSON(json["data"]).description
                     rootModel?.data = data
@@ -426,30 +426,23 @@ extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Respo
                         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)
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<[T]?>.just(nil)
                     }else {
-                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!", textAlignment: .left)
+                        self.showFailInfo(rootModel: rootModel!)
                         return Single<[T]?>.just(nil)
                     }
                 }else if response.statusCode == 401 {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\njson=\n\(json.description)")
-                    let infoModel = InfoModel(JSONString: json.description)
-                    SwiftProgressHUD.shared().showText(infoModel!.message ?? "登录过期,请重新登录")
+                    self.log(response: response, json: json)
                     kAppDelegate.setLoginController()
                     return Single<[T]?>.just(nil)
                 }else {
-                    let url = String(describing: response.request!.url!)
-                    NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)");
-                    SwiftProgressHUD.shared().showText(response.description)
+                    self.logError(response: response)
                     return Single<[T]?>.just(nil)
                 }
                 
             } catch {
-                let url = String(describing: response.request!.url!)
-                NXLLog("\nurl=\(url)\nstatusCode=\(response.statusCode)\nerror=\n\(response.description)")
-                SwiftProgressHUD.shared().showText(response.description)
+                self.logError(response: response)
                 return Single<[T]?>.just(nil)
             }
         }