Преглед на файлове

【IOS】楼层和分类跳转配置了专题页应该可以跳转 bug修改完成

南鑫林 преди 6 години
родител
ревизия
34e3caa451
променени са 15 файла, в които са добавени 190 реда и са изтрити 81 реда
  1. 1 1
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 4 4
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategorySearchView.swift
  3. 3 6
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/CollectionViewCell/ProductMallBarChart/ProductMallBarChartCollectionViewCell.swift
  4. 15 4
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHBigTableViewCell.swift
  5. 0 5
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHSmallTableViewCell.swift
  6. 0 1
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/PopTopTriangleView.swift
  7. 8 8
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallView.swift
  8. 1 11
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift
  9. 6 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/View/SpecialBannerView.swift
  10. 70 26
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/View/SpecialView.swift
  11. 59 0
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift
  12. 11 0
      RainbowPlanet/RainbowPlanet/Service/Model/CMSModel/CMSModel.swift
  13. 5 8
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaNetWorkServiceCMS.swift
  14. 2 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/ApiMacro.swift
  15. 5 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift

+ 1 - 1
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -1812,8 +1812,8 @@
 			isa = PBXGroup;
 			children = (
 				A7A98E3422802A60005306E9 /* ShoppingMallBanner */,
-				A7B4E730228177A90012914A /* ShoppingMallFloor */,
 				A7A98E3E22804647005306E9 /* ShoppingMallSepcial */,
+				A7B4E730228177A90012914A /* ShoppingMallFloor */,
 				A7A98E38228030F8005306E9 /* ShoppingMallCategory */,
 				A775CBFD2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift */,
 				A775CBFF223774A300EBDCF8 /* ShoppingMallView.swift */,

+ 4 - 4
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/View/CategorySearchView.swift

@@ -24,6 +24,10 @@ class CategorySearchView: BaseView {
             if productCartCountModel?.count == 0 {
                shoppingCarButton.pp.hiddenBadge()
             }else {
+                //        shoppingCarButton.pp.setBadge(height: 14)
+                //        shoppingCarButton.pp.badgeView.font = kRegularFont10
+                shoppingCarButton.pp.badgeView.backgroundColor = kfe352bColor
+                shoppingCarButton.pp.moveBadge(x: -2, y: 2)
                 shoppingCarButton.pp.addBadge(number: productCartCountModel?.count ?? 0)
             }
         }
@@ -98,10 +102,6 @@ class CategorySearchView: BaseView {
                 shoppingCarBlock()
             }
         }).disposed(by: disposeBag)
-        //        shoppingCarButton.pp.setBadge(height: 14)
-        //        shoppingCarButton.pp.badgeView.font = kRegularFont10
-        shoppingCarButton.pp.badgeView.backgroundColor = kfe352bColor
-        shoppingCarButton.pp.moveBadge(x: -2, y: 2)
         return shoppingCarButton
     }()
 

+ 3 - 6
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/CollectionViewCell/ProductMallBarChart/ProductMallBarChartCollectionViewCell.swift

@@ -147,19 +147,15 @@ class ProductMallBarChartCollectionViewCell: UICollectionViewCell {
         let sellPriceLabel = UILabel()
         sellPriceLabel.text = "¥11.8"
         sellPriceLabel.textColor = kfe352bColor
-        sellPriceLabel.font = kScaleBoldFont15
+        sellPriceLabel.font = kBoldFont15
         sellPriceLabel.textAlignment = .left
         return sellPriceLabel
     }()
     
     private lazy var markPriceLabel: UILabel = {
         let markPriceLabel = UILabel()
-        markPriceLabel.text = "¥24.4"
         markPriceLabel.textColor = kbbbbbbColor
-        markPriceLabel.font = kScaleRegularFont13
-        let attrString = NSMutableAttributedString(string: "¥24.4")
-        attrString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
-        markPriceLabel.attributedText = attrString
+        markPriceLabel.font = kRegularFont13
         return markPriceLabel
     }()
     
@@ -185,6 +181,7 @@ class ProductMallBarChartCollectionViewCell: UICollectionViewCell {
             sellPriceLabel.text = priceConversion(price: productModel?.price ?? 0)
             let attributeString = NSMutableAttributedString(string:priceConversion(price: productModel?.originPrice ?? 0))
             attributeString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
+            markPriceLabel.attributedText = attributeString
            
             if productModel?.totalStock == 0 {
                 plusButton.isHidden = true

+ 15 - 4
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHBigTableViewCell.swift

@@ -13,6 +13,18 @@ class ProductHBigTableViewCell: UITableViewCell {
     
     let disposeBag = DisposeBag()
     
+    override var frame: CGRect {
+        get {
+            return super.frame
+        }
+        set {
+            var frame = newValue
+            frame.origin.x += 14
+            frame.size.width -= 14 * 2
+            super.frame = frame
+        }
+    }
+    
     typealias PlusClosure = (_ productSearchModel: ProductSearchModel?,_ indexPath:IndexPath?) -> Void
     var plusClosure : PlusClosure?
     
@@ -120,7 +132,6 @@ class ProductHBigTableViewCell: UITableViewCell {
     
     private lazy var sellPriceLabel: UILabel = {
         let sellPriceLabel = UILabel()
-        sellPriceLabel.text = "¥11.8"
         sellPriceLabel.textColor = kfe352bColor
         sellPriceLabel.font = kScaleBoldFont20
         sellPriceLabel.textAlignment = .left
@@ -151,17 +162,17 @@ class ProductHBigTableViewCell: UITableViewCell {
             titleLabel.text = productSearchModel?.name
             detailTitleLabel.text = productSearchModel?.saleName
             sellNumberLabel.text = "已售\(productSearchModel?.totalCount ?? 0)件"
-            sellPriceLabel.text = priceConversion(price: productSearchModel?.price ?? 0)            
+            
+            sellPriceLabel.text = priceConversion(price: productSearchModel?.price ?? 0)
             let attributeString = NSMutableAttributedString(string:priceConversion(price: productSearchModel?.originPrice ?? 0))
             attributeString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
-            markPriceLabel.textColor = kbbbbbbColor
             markPriceLabel.attributedText = attributeString
+            markPriceLabel.textColor = kbbbbbbColor
             if productSearchModel?.totalStock == 0 {
                 self.plusButton.isHidden = true
             }else {
                 self.plusButton.isHidden = false
             }
-
         }
     }
 

+ 0 - 5
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductView/TableViewCell/ProductHSmallTableViewCell.swift

@@ -121,7 +121,6 @@ class ProductHSmallTableViewCell: UITableViewCell {
     
     private lazy var sellPriceLabel: UILabel = {
         let sellPriceLabel = UILabel()
-        sellPriceLabel.text = "¥11.8"
         sellPriceLabel.textColor = kfe352bColor
         sellPriceLabel.font = kScaleBoldFont15
         sellPriceLabel.textAlignment = .left
@@ -130,12 +129,8 @@ class ProductHSmallTableViewCell: UITableViewCell {
     
     private lazy var markPriceLabel: UILabel = {
         let markPriceLabel = UILabel()
-        markPriceLabel.text = "¥24.4"
         markPriceLabel.textColor = kbbbbbbColor
         markPriceLabel.font = kScaleRegularFont13
-        let attrString = NSMutableAttributedString(string: "¥24.4")
-        attrString.changeStrikethrough(atAllStyle: NSUnderlineStyle.single, color: kbbbbbbColor)
-        markPriceLabel.attributedText = attrString
         return markPriceLabel
     }()
     

+ 0 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/PopTopTriangleView.swift

@@ -78,7 +78,6 @@ class PopTopTriangleView: BaseView {
     
     private lazy var addressLabel: UILabel = {
         let addressLabel = UILabel()
-        addressLabel.text = "建设西路新旅城南门自提点"
         addressLabel.textColor = kffffffColor
         addressLabel.font = kScaleRegularFont14
         addressLabel.numberOfLines = 0

+ 8 - 8
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/View/ShoppingMallView.swift

@@ -66,6 +66,14 @@ class ShoppingMallView: BaseView {
         }
     }
     
+    //初始化自提地址提示View
+    lazy var selfAddressPopView: PopTopTriangleView = {
+        let selfAddressPopView = PopTopTriangleView()
+        let addrMdl = SelfMentionAddressModel.getModel()
+        selfAddressPopView.address = addrMdl?.address
+        return selfAddressPopView
+    }()
+    
     //1.初始化JXSegmentedView
     lazy var segmentedView: JXSegmentedView = {
         let segmentedView = JXSegmentedView()
@@ -107,14 +115,6 @@ class ShoppingMallView: BaseView {
         return listContainerView
     }()
     
-    //5.初始化自提地址提示View
-    lazy var selfAddressPopView: PopTopTriangleView = {
-        let selfAddressPopView = PopTopTriangleView()
-        let addrMdl = SelfMentionAddressModel.getModel()
-        selfAddressPopView.address = addrMdl?.address
-        return selfAddressPopView
-    }()
-    
 }
 
 extension ShoppingMallView : JXSegmentedViewDelegate {

+ 1 - 11
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift

@@ -26,13 +26,6 @@ class ShoppingMallViewController: BaseViewController {
     override func setupViews() {
         super.setupViews()
         navigationBar.addSubview(navigationBarView)
-//        let emptyView =  EmptyView.shared.diyCustomEmptyViewStyle1(iconStr: "page06", titleStr: "网络有误,请重新加载", buttonStr: "重新加载", buttonActionBlock: {
-//            [weak self] in
-//            self?.cmsTemplateSetTemplateNameApi()
-//        })
-//        emptyView.contentViewY = kScaleValue(value: 100) + kNavBarTotalHeight
-//        view.ly_emptyView = emptyView
-        
     }
 
     override func setupLayouts() {
@@ -125,15 +118,12 @@ class ShoppingMallViewController: BaseViewController {
         SwiftMoyaNetWorkServiceCMS.shared().cmsTemplateSetTemplateNameApi(completion: {
             [weak self] (cmsTemplateModels) -> (Void) in
             let cmsTemplateModels = cmsTemplateModels as! Array<CMSTemplateModel>
-//            self?.view.ly_hideEmpty()
             self?.shoppingMallView.snp.makeConstraints { (make) in
                 make.bottom.left.right.equalToSuperview()
                 make.top.equalTo(kNavBarTotalHeight)
             }
             self?.shoppingMallView.cmsTemplateModels = cmsTemplateModels
-        }) { [weak self] () -> (Void) in
-//            self?.view.ly_showEmpty()
-        }
+        })
     }
 }
 

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/View/SpecialBannerView.swift

@@ -31,4 +31,10 @@ class SpecialBannerView: BaseView {
         bannerButton.masksToBounds = true
         return bannerButton
     }()
+    
+    var cmsRuleModel : CMSRuleModel? {
+        didSet {
+            bannerButton.kf.setImage(with: kURLImage(name: cmsRuleModel?.url ?? "pic_preload"), for: UIControl.State.normal, placeholder: kImage(name: "pic_preload"))
+        }
+    }
 }

+ 70 - 26
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/View/SpecialView.swift

@@ -21,12 +21,25 @@ class SpecialView: BaseView {
         }
     }
     
+    var cmsRuleModel : CMSRuleModel? {
+        didSet {
+            specialBannerView.cmsRuleModel = cmsRuleModel
+            tableView.tableHeaderView = specialBannerView
+            tableView.reloadData()
+        }
+    }
     typealias DidSelectRow = (_ indexPath: IndexPath) -> Void
     var didSelectRow : DidSelectRow?
     
+    typealias AddCartClosure = (ProductSearchModel,IndexPath) -> Void
+    var addCartClosure : AddCartClosure?
     
     override func setupViews() {
         addSubview(tableView)
+        let emptyView =  EmptyView.shared.diyCustomEmptyViewStyle2(iconStr: "page04", titleStr: "当前暂无数据")
+        emptyView.contentViewY = kScaleValue(value: 182)
+        tableView.ly_emptyView = emptyView
+        tableView.ly_startLoading()
     }
     
     override func setupLayouts() {
@@ -37,16 +50,15 @@ class SpecialView: BaseView {
     
     //左侧表格
     lazy var tableView : UITableView = {
-        let tableView = UITableView()
+        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
         tableView.delegate = self
         tableView.dataSource = self
         tableView.showsVerticalScrollIndicator = false
         tableView.separatorColor = UIColor.clear
         tableView.backgroundColor = kf5f5f5Color
-        tableView.tableHeaderView = specialBannerView
         return tableView
     }()
-    //
+    
     lazy var specialBannerView: SpecialBannerView = {
         let specialBannerView = SpecialBannerView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 110 * kScaleWidth))
         return specialBannerView
@@ -57,14 +69,12 @@ class SpecialView: BaseView {
 extension SpecialView : UITableViewDataSource, UITableViewDelegate {
     //表格分区数
     func numberOfSections(in tableView: UITableView) -> Int {
-//        return productSearchModelArray?.isEmpty ?? true ? 0 : 1
-        return 1
+        return productSearchModelArray?.isEmpty ?? true ? 0 : 1
     }
     
     //分区下单元格数量
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-//        return productSearchModelArray?.isEmpty ?? true ? 0 : productSearchModelArray?.count ?? 0
-        return 10
+        return productSearchModelArray?.isEmpty ?? true ? 0 : productSearchModelArray?.count ?? 0
     }
     
     //返回自定义单元格
@@ -77,29 +87,46 @@ extension SpecialView : UITableViewDataSource, UITableViewDelegate {
             //下面为设置圆角操作(通过遮罩实现)
             let shapeLayer = CAShapeLayer()
             cell.layer.mask = nil
-            switch indexPath.row {
-            //如果是第一行,左上、右上角为圆角
-            case 0:
+            if productSearchModelArray!.count == 1 {
                 var bounds = cell.bounds
                 bounds.origin.y += 1.0  //这样每一组首行顶部分割线不显示
                 let bezierPath = UIBezierPath(roundedRect: bounds,
-                                              byRoundingCorners: [.topLeft,.topRight],
+                                              byRoundingCorners: [.allCorners],
                                               cornerRadii: CGSize(width: cornerRadius,height: cornerRadius))
                 shapeLayer.path = bezierPath.cgPath
                 cell.layer.mask = shapeLayer
-            //如果是最后一行,左下、右下角为圆角
-            case 9:
-                var bounds = cell.bounds
-                bounds.size.height -= 1.0  //这样每一组尾行底部分割线不显示
-                let bezierPath = UIBezierPath(roundedRect: bounds,
-                                              byRoundingCorners: [.bottomLeft,.bottomRight],
-                                              cornerRadii: CGSize(width: cornerRadius,height: cornerRadius))
-                shapeLayer.path = bezierPath.cgPath
-                cell.layer.mask = shapeLayer
-            default:
-                break
+            }else {
+                switch indexPath.row {
+                //如果是第一行,左上、右上角为圆角
+                case 0:
+                    var bounds = cell.bounds
+                    bounds.origin.y += 1.0  //这样每一组首行顶部分割线不显示
+                    let bezierPath = UIBezierPath(roundedRect: bounds,
+                                                  byRoundingCorners: [.topLeft,.topRight],
+                                                  cornerRadii: CGSize(width: cornerRadius,height: cornerRadius))
+                    shapeLayer.path = bezierPath.cgPath
+                    cell.layer.mask = shapeLayer
+                //如果是最后一行,左下、右下角为圆角
+                case productSearchModelArray!.count - 1:
+                    var bounds = cell.bounds
+                    bounds.size.height -= 1.0  //这样每一组尾行底部分割线不显示
+                    let bezierPath = UIBezierPath(roundedRect: bounds,
+                                                  byRoundingCorners: [.bottomLeft,.bottomRight],
+                                                  cornerRadii: CGSize(width: cornerRadius,height: cornerRadius))
+                    shapeLayer.path = bezierPath.cgPath
+                    cell.layer.mask = shapeLayer
+                default:
+                    break
+                }
             }
-//        cell.productSearchModel = productSearchModelArray![indexPath.row]
+        cell.productSearchModel = productSearchModelArray![indexPath.row]
+        cell.plusClosure = {
+            [weak self] (productSearchModel,indexPath) in
+            
+            if let addCartClosure = self?.addCartClosure {
+                addCartClosure(productSearchModel!,indexPath!)
+            }
+        }
         return cell
     }
     
@@ -113,14 +140,31 @@ extension SpecialView : UITableViewDataSource, UITableViewDelegate {
         return 140
     }
     
-    //分区头高度(只有右侧表格有分区头)
+    //分区头高度
     func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        return 0
+        if cmsRuleModel == nil {
+            return 10
+        }else {
+            return 0
+        }
     }
     
-    //返回自定义分区头(只有右侧表格有分区头)
+    //返回自定义分区头
     func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        let view = UIView(frame: CGRect(x: 0, y: 0, width: kScaleWidth, height: 10))
+        view.backgroundColor = kf5f5f5Color
+        return view
+    }
+    
+    //分区头高度
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return 0
+    }
+    
+    //返回自定义分区头
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
         return nil
     }
+    
 }
 

+ 59 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift

@@ -12,6 +12,7 @@ class SpecialViewController: BaseViewController {
     
     var cmsRuleModel : CMSRuleModel?
     var area_type : String?
+    var productSearchModelArray = Array<ProductSearchModel>()
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -38,6 +39,15 @@ class SpecialViewController: BaseViewController {
     }
     
     override func setupData() {
+        
+        if area_type == "floor" {
+            specialView.cmsRuleModel = cmsRuleModel
+        }
+        productGetCartCountApi()
+        specialView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
+            self?.cmsTemplateSetProductListApi()
+        }
+        
         categorySearchView.searchbgView.rx.tap.subscribe(onNext: {
             [weak self] in
             let vc = SearchViewController()
@@ -46,6 +56,25 @@ class SpecialViewController: BaseViewController {
                 
             })
         }).disposed(by: disposeBag)
+        categorySearchView.shoppingCarBlock = {
+            [weak self] in
+            
+            let vc = ShoppingCartViewController()
+            vc.shoppingCartVCType = .push
+            self?.navigationController?.pushViewController(vc, animated: true)
+        }
+        specialView.didSelectRow = {
+            [weak self] (indexPath) in
+            let vc = ProductDetailViewController()
+            let productSearch = self?.productSearchModelArray[indexPath.row]
+            vc.productId = productSearch?.id
+            vc.shopId = productSearch?.shopId
+            self?.navigationController?.pushViewController(vc, animated: true)
+        }
+        specialView.addCartClosure = {
+            [weak self]  (productSearchModel,indexPath) in
+            self?.addCart(productSearchModel: productSearchModel, indexPath: indexPath)
+        }
     }
     
     private lazy var categorySearchView: CategorySearchView = {
@@ -56,4 +85,34 @@ class SpecialViewController: BaseViewController {
         let specialView = SpecialView()
         return specialView
     }()
+    
+    /// 获取商品列表
+    func cmsTemplateSetProductListApi() {
+        SwiftMoyaNetWorkServiceCMS.shared().cmsTemplateSetProductListApi(subjectId: self.cmsRuleModel?.linkUrl ?? "", completion: {
+                [weak self] (productSearchListModel) -> (Void) in
+            self?.productSearchModelArray = productSearchListModel as! [ProductSearchModel]
+                self?.specialView.productSearchModelArray = self?.productSearchModelArray
+        })
+    }
+    
+    /// 获取购物车数量
+    func productGetCartCountApi() {
+        SwiftMoyaNetWorkServiceProduct.shared().productGetCartCountApi {
+            [weak self] (productCartCountModel) -> (Void) in
+            self?.categorySearchView.productCartCountModel = productCartCountModel as? ProductCartCountModel
+        }
+    }
+    
+    /// 添加购物车
+    ///
+    /// - Returns:
+    func addCart(productSearchModel:ProductSearchModel,indexPath:IndexPath) {
+        productSearchModel.isSelect = 1
+        SwiftMoyaNetWorkServiceProduct.shared().productCartListAddApi(productSearchModel: productSearchModel, completion: {
+            [weak self] (cartAmountModel) -> (Void) in
+            self?.specialView.tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
+            SwiftProgressHUD.shared().showText("已加入购物车", view: (self?.specialView.tableView)!, textAlignment: .center)
+            self?.productGetCartCountApi()
+        })
+    }
 }

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

@@ -140,5 +140,16 @@ class CMSRuleModel : NSObject, Mappable{
         subjectId <- map["subject_id"]
     }
     
+//    let transform = TransformOf<String, Int>(fromJSON: { (value: Int?) -> String?  in
+//         // 将值从 Int? 变换为 String?
+//        if let value = value {
+//            return String(value)
+//        }
+//        return nil
+//    }, toJSON: { (value: String?) -> Int? in
+//        // 将值从 String? 变换为 Int?
+//        return Int(value!)
+//    })
+    
 }
 

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

@@ -31,15 +31,12 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     /// 获取模板名称
     ///
     /// - Parameter completion: 完成
-    func cmsTemplateSetTemplateNameApi(completion: @escaping apiCallBack,falseCompletion: @escaping apiFalseCallBack) {
+    func cmsTemplateSetTemplateNameApi(completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
         let loacationModel = LocationModel.shared().getLocationModel()
         let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
         parameters.updateValue(baiduToCityModel.areaCode, forKey: "city_id")
         SwiftProgressHUD.shared().showWait()
-        SwiftMoyaNetWorkManager.shared().falseCallback = {
-            falseCompletion()
-        }
         SwiftMoyaNetWorkManager.shared().requestArray(CMSTemplateModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetTemplateName(parameters: parameters))) {
             (cmsTemplateModels) in
             SwiftProgressHUD.shared().hide()
@@ -67,14 +64,14 @@ class SwiftMoyaNetWorkServiceCMS: NSObject {
     /// 获取商品列表
     ///
     /// - Parameter completion: 完成
-    func cmsTemplateSetProductListApi(subjectId:Int = 0,block:String = "",completion: @escaping apiCallBack) {
+    func cmsTemplateSetProductListApi(subjectId:String = "",completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(subjectId, forKey: "subject_id")
         SwiftProgressHUD.shared().showWait()
-        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetProductList(parameters: parameters))) {
-            (data) in
+        SwiftMoyaNetWorkManager.shared().requestArray(ProductSearchModel.self,target: MultiTarget(SwiftMoyaServiceCMSApi.cmsTemplateSetProductList(parameters: parameters))) {
+            (productSearchModels) in
             SwiftProgressHUD.shared().hide()
-            completion(data)
+            completion(productSearchModels)
         }
     }
 }

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

@@ -8,8 +8,8 @@
 
 import Foundation
 
-let kDevelopSever = false
-let kTestSever = true
+let kDevelopSever = true
+let kTestSever = false
 let kProductSever = false
 
 // MARK: - 数据服务器

+ 5 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift

@@ -445,7 +445,7 @@ extension SwiftMoyaNetWorkManager {
                 }
                 
             }else {
-                SwiftProgressHUD.shared().showError(rootModel!.msg ?? "信息有误!!!")
+                SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
                 if let falseCallback = self.falseCallback  {
                     falseCallback()
                 }
@@ -495,7 +495,7 @@ extension SwiftMoyaNetWorkManager {
                 }
                 
             }else {
-                SwiftProgressHUD.shared().showError(rootModel!.msg ?? "信息有误!!!")
+                SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
                 if let falseCallback = self.falseCallback  {
                     falseCallback()
                 }
@@ -546,7 +546,7 @@ extension SwiftMoyaNetWorkManager {
                 }
                 
             }else {
-                SwiftProgressHUD.shared().showError(rootModel!.msg ?? "信息有误!!!")
+                SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
                 if let falseCallback = self.falseCallback  {
                     falseCallback()
                 }
@@ -593,10 +593,10 @@ 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().showError(rootModel!.msg ?? "信息有误!!!")
+                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
                         return Single<T?>.just(nil)
                     }else {
-                        SwiftProgressHUD.shared().showError(rootModel!.msg ?? "信息有误!!!")
+                        SwiftProgressHUD.shared().showText(rootModel!.msg ?? "信息有误!!!")
                         return Single<T?>.just(nil)
                     }
                 }else if response.statusCode == 401 {