|
@@ -6,7 +6,7 @@ import Foundation
|
|
import ObjectMapper
|
|
import ObjectMapper
|
|
|
|
|
|
|
|
|
|
-class ProductModel : NSObject, NSCoding, Mappable{
|
|
|
|
|
|
+class ProductModel : NSObject, Mappable{
|
|
|
|
|
|
var attributeCategoryId : Int?
|
|
var attributeCategoryId : Int?
|
|
var bigImg : String?
|
|
var bigImg : String?
|
|
@@ -52,6 +52,18 @@ class ProductModel : NSObject, NSCoding, Mappable{
|
|
var updatedAt : String?
|
|
var updatedAt : String?
|
|
var video : String?
|
|
var video : String?
|
|
var wasteStatus : Int?
|
|
var wasteStatus : Int?
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 购物车
|
|
|
|
+ var cityName : String?
|
|
|
|
+ var amount : Int?
|
|
|
|
+ var isSelect : Int?
|
|
|
|
+ var productId : Int?
|
|
|
|
+ var productImg : String?
|
|
|
|
+ var productName : String?
|
|
|
|
+ var productPrice : Int?
|
|
|
|
+ var skuPrice : Int?
|
|
|
|
+ var uid : Int?
|
|
|
|
|
|
|
|
|
|
class func newInstance(map: Map) -> Mappable?{
|
|
class func newInstance(map: Map) -> Mappable?{
|
|
@@ -106,201 +118,16 @@ class ProductModel : NSObject, NSCoding, Mappable{
|
|
updatedAt <- map["updated_at"]
|
|
updatedAt <- map["updated_at"]
|
|
video <- map["video"]
|
|
video <- map["video"]
|
|
wasteStatus <- map["waste_status"]
|
|
wasteStatus <- map["waste_status"]
|
|
|
|
+ // 购物车
|
|
|
|
+ amount <- map["amount"]
|
|
|
|
+ isSelect <- map["is_select"]
|
|
|
|
+ productId <- map["product_id"]
|
|
|
|
+ productImg <- map["product_img"]
|
|
|
|
+ productName <- map["product_name"]
|
|
|
|
+ productPrice <- map["product_price"]
|
|
|
|
+ skuPrice <- map["sku_price"]
|
|
|
|
+ uid <- map["uid"]
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * NSCoding required initializer.
|
|
|
|
- * Fills the data from the passed decoder
|
|
|
|
- */
|
|
|
|
- @objc required init(coder aDecoder: NSCoder)
|
|
|
|
- {
|
|
|
|
- attributeCategoryId = aDecoder.decodeObject(forKey: "attribute_category_id") as? Int
|
|
|
|
- bigImg = aDecoder.decodeObject(forKey: "big_img") as? String
|
|
|
|
- categoryId1 = aDecoder.decodeObject(forKey: "category_id1") as? Int
|
|
|
|
- categoryId2 = aDecoder.decodeObject(forKey: "category_id2") as? Int
|
|
|
|
- categoryId3 = aDecoder.decodeObject(forKey: "category_id3") as? Int
|
|
|
|
- cityId = aDecoder.decodeObject(forKey: "city_id") as? Int
|
|
|
|
- commentNumber = aDecoder.decodeObject(forKey: "comment_number") as? Int
|
|
|
|
- commentScore = aDecoder.decodeObject(forKey: "comment_score") as? Int
|
|
|
|
- commentStar = aDecoder.decodeObject(forKey: "comment_star") as? String
|
|
|
|
- createdAt = aDecoder.decodeObject(forKey: "created_at") as? String
|
|
|
|
- deletedAt = aDecoder.decodeObject(forKey: "deleted_at") as? String
|
|
|
|
- deliverType = aDecoder.decodeObject(forKey: "deliver_type") as? Int
|
|
|
|
- desc = aDecoder.decodeObject(forKey: "desc") as? String
|
|
|
|
- id = aDecoder.decodeObject(forKey: "id") as? Int
|
|
|
|
- img = aDecoder.decodeObject(forKey: "img") as? String
|
|
|
|
- isConfirmSale = aDecoder.decodeObject(forKey: "is_confirm_sale") as? Int
|
|
|
|
- isMain = aDecoder.decodeObject(forKey: "is_main") as? Int
|
|
|
|
- limitNumber = aDecoder.decodeObject(forKey: "limit_number") as? Int
|
|
|
|
- limitType = aDecoder.decodeObject(forKey: "limit_type") as? String
|
|
|
|
- name = aDecoder.decodeObject(forKey: "name") as? String
|
|
|
|
- originPrice = aDecoder.decodeObject(forKey: "origin_price") as? Int
|
|
|
|
- otherCode = aDecoder.decodeObject(forKey: "other_code") as? String
|
|
|
|
- price = aDecoder.decodeObject(forKey: "price") as? Int
|
|
|
|
- receiveTime = aDecoder.decodeObject(forKey: "receive_time") as? String
|
|
|
|
- receiveType = aDecoder.decodeObject(forKey: "receive_type") as? Int
|
|
|
|
- saleName = aDecoder.decodeObject(forKey: "sale_name") as? String
|
|
|
|
- saleStatus = aDecoder.decodeObject(forKey: "sale_status") as? Int
|
|
|
|
- shopId = aDecoder.decodeObject(forKey: "shop_id") as? Int
|
|
|
|
- shopName = aDecoder.decodeObject(forKey: "shop_name") as? String
|
|
|
|
- skuCode = aDecoder.decodeObject(forKey: "sku_code") as? String
|
|
|
|
- skuId = aDecoder.decodeObject(forKey: "sku_id") as? Int
|
|
|
|
- skuName = aDecoder.decodeObject(forKey: "sku_name") as? String
|
|
|
|
- sort = aDecoder.decodeObject(forKey: "sort") as? Int
|
|
|
|
- spuCode = aDecoder.decodeObject(forKey: "spu_code") as? String
|
|
|
|
- status = aDecoder.decodeObject(forKey: "status") as? Int
|
|
|
|
- stock = aDecoder.decodeObject(forKey: "stock") as? Int
|
|
|
|
- storeTypeIds = aDecoder.decodeObject(forKey: "store_type_ids") as? String
|
|
|
|
- subtitle = aDecoder.decodeObject(forKey: "subtitle") as? String
|
|
|
|
- totalCount = aDecoder.decodeObject(forKey: "total_count") as? Int
|
|
|
|
- totalStock = aDecoder.decodeObject(forKey: "total_stock") as? Int
|
|
|
|
- upStatus = aDecoder.decodeObject(forKey: "up_status") as? Int
|
|
|
|
- updatedAt = aDecoder.decodeObject(forKey: "updated_at") as? String
|
|
|
|
- video = aDecoder.decodeObject(forKey: "video") as? String
|
|
|
|
- wasteStatus = aDecoder.decodeObject(forKey: "waste_status") as? Int
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * NSCoding required method.
|
|
|
|
- * Encodes mode properties into the decoder
|
|
|
|
- */
|
|
|
|
- @objc func encode(with aCoder: NSCoder)
|
|
|
|
- {
|
|
|
|
- if attributeCategoryId != nil{
|
|
|
|
- aCoder.encode(attributeCategoryId, forKey: "attribute_category_id")
|
|
|
|
- }
|
|
|
|
- if bigImg != nil{
|
|
|
|
- aCoder.encode(bigImg, forKey: "big_img")
|
|
|
|
- }
|
|
|
|
- if categoryId1 != nil{
|
|
|
|
- aCoder.encode(categoryId1, forKey: "category_id1")
|
|
|
|
- }
|
|
|
|
- if categoryId2 != nil{
|
|
|
|
- aCoder.encode(categoryId2, forKey: "category_id2")
|
|
|
|
- }
|
|
|
|
- if categoryId3 != nil{
|
|
|
|
- aCoder.encode(categoryId3, forKey: "category_id3")
|
|
|
|
- }
|
|
|
|
- if cityId != nil{
|
|
|
|
- aCoder.encode(cityId, forKey: "city_id")
|
|
|
|
- }
|
|
|
|
- if commentNumber != nil{
|
|
|
|
- aCoder.encode(commentNumber, forKey: "comment_number")
|
|
|
|
- }
|
|
|
|
- if commentScore != nil{
|
|
|
|
- aCoder.encode(commentScore, forKey: "comment_score")
|
|
|
|
- }
|
|
|
|
- if commentStar != nil{
|
|
|
|
- aCoder.encode(commentStar, forKey: "comment_star")
|
|
|
|
- }
|
|
|
|
- if createdAt != nil{
|
|
|
|
- aCoder.encode(createdAt, forKey: "created_at")
|
|
|
|
- }
|
|
|
|
- if deletedAt != nil{
|
|
|
|
- aCoder.encode(deletedAt, forKey: "deleted_at")
|
|
|
|
- }
|
|
|
|
- if deliverType != nil{
|
|
|
|
- aCoder.encode(deliverType, forKey: "deliver_type")
|
|
|
|
- }
|
|
|
|
- if desc != nil{
|
|
|
|
- aCoder.encode(desc, forKey: "desc")
|
|
|
|
- }
|
|
|
|
- if id != nil{
|
|
|
|
- aCoder.encode(id, forKey: "id")
|
|
|
|
- }
|
|
|
|
- if img != nil{
|
|
|
|
- aCoder.encode(img, forKey: "img")
|
|
|
|
- }
|
|
|
|
- if isConfirmSale != nil{
|
|
|
|
- aCoder.encode(isConfirmSale, forKey: "is_confirm_sale")
|
|
|
|
- }
|
|
|
|
- if isMain != nil{
|
|
|
|
- aCoder.encode(isMain, forKey: "is_main")
|
|
|
|
- }
|
|
|
|
- if limitNumber != nil{
|
|
|
|
- aCoder.encode(limitNumber, forKey: "limit_number")
|
|
|
|
- }
|
|
|
|
- if limitType != nil{
|
|
|
|
- aCoder.encode(limitType, forKey: "limit_type")
|
|
|
|
- }
|
|
|
|
- if name != nil{
|
|
|
|
- aCoder.encode(name, forKey: "name")
|
|
|
|
- }
|
|
|
|
- if originPrice != nil{
|
|
|
|
- aCoder.encode(originPrice, forKey: "origin_price")
|
|
|
|
- }
|
|
|
|
- if otherCode != nil{
|
|
|
|
- aCoder.encode(otherCode, forKey: "other_code")
|
|
|
|
- }
|
|
|
|
- if price != nil{
|
|
|
|
- aCoder.encode(price, forKey: "price")
|
|
|
|
- }
|
|
|
|
- if receiveTime != nil{
|
|
|
|
- aCoder.encode(receiveTime, forKey: "receive_time")
|
|
|
|
- }
|
|
|
|
- if receiveType != nil{
|
|
|
|
- aCoder.encode(receiveType, forKey: "receive_type")
|
|
|
|
- }
|
|
|
|
- if saleName != nil{
|
|
|
|
- aCoder.encode(saleName, forKey: "sale_name")
|
|
|
|
- }
|
|
|
|
- if saleStatus != nil{
|
|
|
|
- aCoder.encode(saleStatus, forKey: "sale_status")
|
|
|
|
- }
|
|
|
|
- if shopId != nil{
|
|
|
|
- aCoder.encode(shopId, forKey: "shop_id")
|
|
|
|
- }
|
|
|
|
- if shopName != nil{
|
|
|
|
- aCoder.encode(shopName, forKey: "shop_name")
|
|
|
|
- }
|
|
|
|
- if skuCode != nil{
|
|
|
|
- aCoder.encode(skuCode, forKey: "sku_code")
|
|
|
|
- }
|
|
|
|
- if skuId != nil{
|
|
|
|
- aCoder.encode(skuId, forKey: "sku_id")
|
|
|
|
- }
|
|
|
|
- if skuName != nil{
|
|
|
|
- aCoder.encode(skuName, forKey: "sku_name")
|
|
|
|
- }
|
|
|
|
- if sort != nil{
|
|
|
|
- aCoder.encode(sort, forKey: "sort")
|
|
|
|
- }
|
|
|
|
- if spuCode != nil{
|
|
|
|
- aCoder.encode(spuCode, forKey: "spu_code")
|
|
|
|
- }
|
|
|
|
- if status != nil{
|
|
|
|
- aCoder.encode(status, forKey: "status")
|
|
|
|
- }
|
|
|
|
- if stock != nil{
|
|
|
|
- aCoder.encode(stock, forKey: "stock")
|
|
|
|
- }
|
|
|
|
- if storeTypeIds != nil{
|
|
|
|
- aCoder.encode(storeTypeIds, forKey: "store_type_ids")
|
|
|
|
- }
|
|
|
|
- if subtitle != nil{
|
|
|
|
- aCoder.encode(subtitle, forKey: "subtitle")
|
|
|
|
- }
|
|
|
|
- if totalCount != nil{
|
|
|
|
- aCoder.encode(totalCount, forKey: "total_count")
|
|
|
|
- }
|
|
|
|
- if totalStock != nil{
|
|
|
|
- aCoder.encode(totalStock, forKey: "total_stock")
|
|
|
|
- }
|
|
|
|
- if upStatus != nil{
|
|
|
|
- aCoder.encode(upStatus, forKey: "up_status")
|
|
|
|
- }
|
|
|
|
- if updatedAt != nil{
|
|
|
|
- aCoder.encode(updatedAt, forKey: "updated_at")
|
|
|
|
- }
|
|
|
|
- if video != nil{
|
|
|
|
- aCoder.encode(video, forKey: "video")
|
|
|
|
- }
|
|
|
|
- if wasteStatus != nil{
|
|
|
|
- aCoder.encode(wasteStatus, forKey: "waste_status")
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|