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