|
@@ -25,6 +25,26 @@ public let kProductHomeProductApi = "/product/honmeProduct"
|
|
/// 购物车列表
|
|
/// 购物车列表
|
|
public let kProductCartListApi = "/product/cartList"
|
|
public let kProductCartListApi = "/product/cartList"
|
|
|
|
|
|
|
|
+// MARK: - 购物车-添加
|
|
|
|
+/// 购物车-添加
|
|
|
|
+public let kProductCartAddApi = "/product/cartAdd"
|
|
|
|
+
|
|
|
|
+// MARK: - 购物车-删除
|
|
|
|
+/// 购物车-删除
|
|
|
|
+public let kProductCartDeleteApi = "/product/deleteCart"
|
|
|
|
+
|
|
|
|
+// MARK: - 购物车-数量
|
|
|
|
+/// 购物车-数量
|
|
|
|
+public let kProductCartAmountApi = "/product/setProductAmount"
|
|
|
|
+
|
|
|
|
+// MARK: - 购物车-选中
|
|
|
|
+/// 购物车-选中
|
|
|
|
+public let kProductCartIsSelApi = "/cart/isSelect"
|
|
|
|
+
|
|
|
|
+// MARK: - 购物车-全选
|
|
|
|
+/// 购物车-全选
|
|
|
|
+public let kProductCartAllSelApi = "/cart/isSelectAll"
|
|
|
|
+
|
|
|
|
|
|
/// 商品
|
|
/// 商品
|
|
///
|
|
///
|
|
@@ -32,11 +52,21 @@ public let kProductCartListApi = "/product/cartList"
|
|
/// - productCategory: 商品分类
|
|
/// - productCategory: 商品分类
|
|
/// - productHomeProduct: 首页商品
|
|
/// - productHomeProduct: 首页商品
|
|
/// - productCartList: 购物车列表
|
|
/// - productCartList: 购物车列表
|
|
|
|
+/// - productCartAdd: 购物车-添加
|
|
|
|
+/// - productCartDelete: 购物车-删除
|
|
|
|
+/// - productCartAmount: 购物车-数量
|
|
|
|
+/// - productCartIsSel: 购物车-选中
|
|
|
|
+/// - productCartAllSel: 购物车-全选
|
|
public enum SwiftMoyaServiceProductApi {
|
|
public enum SwiftMoyaServiceProductApi {
|
|
case productSearch(parameters:Dictionary<String, Any>)
|
|
case productSearch(parameters:Dictionary<String, Any>)
|
|
case productCategory(parameters:Dictionary<String, Any>)
|
|
case productCategory(parameters:Dictionary<String, Any>)
|
|
case productHomeProduct(parameters:Dictionary<String, Any>)
|
|
case productHomeProduct(parameters:Dictionary<String, Any>)
|
|
case productCartList(parameters:Dictionary<String, Any>)
|
|
case productCartList(parameters:Dictionary<String, Any>)
|
|
|
|
+ case productCartAdd(parameters:Dictionary<String, Any>)
|
|
|
|
+ case productCartDelete(parameters:Dictionary<String, Any>)
|
|
|
|
+ case productCartAmount(parameters:Dictionary<String, Any>)
|
|
|
|
+ case productCartIsSel(parameters:Dictionary<String, Any>)
|
|
|
|
+ case productCartAllSel(parameters:Dictionary<String, Any>)
|
|
}
|
|
}
|
|
|
|
|
|
extension SwiftMoyaServiceProductApi: TargetType {
|
|
extension SwiftMoyaServiceProductApi: TargetType {
|
|
@@ -46,7 +76,12 @@ extension SwiftMoyaServiceProductApi: TargetType {
|
|
case .productSearch,
|
|
case .productSearch,
|
|
.productCategory,
|
|
.productCategory,
|
|
.productHomeProduct,
|
|
.productHomeProduct,
|
|
- .productCartList
|
|
|
|
|
|
+ .productCartList,
|
|
|
|
+ .productCartAdd,
|
|
|
|
+ .productCartDelete,
|
|
|
|
+ .productCartAmount,
|
|
|
|
+ .productCartIsSel,
|
|
|
|
+ .productCartAllSel
|
|
:
|
|
:
|
|
return URL(string: kApiDataPrefix())!
|
|
return URL(string: kApiDataPrefix())!
|
|
}
|
|
}
|
|
@@ -62,6 +97,16 @@ extension SwiftMoyaServiceProductApi: TargetType {
|
|
return kProductHomeProductApi
|
|
return kProductHomeProductApi
|
|
case .productCartList:
|
|
case .productCartList:
|
|
return kProductCartListApi
|
|
return kProductCartListApi
|
|
|
|
+ case .productCartAdd:
|
|
|
|
+ return kProductCartAddApi
|
|
|
|
+ case .productCartDelete:
|
|
|
|
+ return kProductCartDeleteApi
|
|
|
|
+ case .productCartAmount:
|
|
|
|
+ return kProductCartAmountApi
|
|
|
|
+ case .productCartIsSel:
|
|
|
|
+ return kProductCartIsSelApi
|
|
|
|
+ case .productCartAllSel:
|
|
|
|
+ return kProductCartAllSelApi
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -73,6 +118,17 @@ extension SwiftMoyaServiceProductApi: TargetType {
|
|
.productCartList
|
|
.productCartList
|
|
:
|
|
:
|
|
return .post
|
|
return .post
|
|
|
|
+ case .productCartAdd,
|
|
|
|
+ .productCartAmount,
|
|
|
|
+ .productCartIsSel,
|
|
|
|
+ .productCartAllSel
|
|
|
|
+ :
|
|
|
|
+// return .put
|
|
|
|
+ return .post
|
|
|
|
+ case .productCartDelete
|
|
|
|
+ :
|
|
|
|
+// return .delete
|
|
|
|
+ return .post
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -82,7 +138,12 @@ extension SwiftMoyaServiceProductApi: TargetType {
|
|
case .productSearch(var parameters),
|
|
case .productSearch(var parameters),
|
|
.productCategory(var parameters),
|
|
.productCategory(var parameters),
|
|
.productHomeProduct(var parameters),
|
|
.productHomeProduct(var parameters),
|
|
- .productCartList(var parameters)
|
|
|
|
|
|
+ .productCartList(var parameters),
|
|
|
|
+ .productCartAdd(var parameters),
|
|
|
|
+ .productCartDelete(var parameters),
|
|
|
|
+ .productCartAmount(var parameters),
|
|
|
|
+ .productCartIsSel(var parameters),
|
|
|
|
+ .productCartAllSel(var parameters)
|
|
:
|
|
:
|
|
let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
|
|
let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
|
|
parameters.updateValue(sign, forKey: "sign")
|
|
parameters.updateValue(sign, forKey: "sign")
|
|
@@ -108,7 +169,12 @@ extension SwiftMoyaServiceProductApi: TargetType {
|
|
case .productSearch,
|
|
case .productSearch,
|
|
.productCategory,
|
|
.productCategory,
|
|
.productHomeProduct,
|
|
.productHomeProduct,
|
|
- .productCartList
|
|
|
|
|
|
+ .productCartList,
|
|
|
|
+ .productCartAdd,
|
|
|
|
+ .productCartDelete,
|
|
|
|
+ .productCartAmount,
|
|
|
|
+ .productCartIsSel,
|
|
|
|
+ .productCartAllSel
|
|
:
|
|
:
|
|
return (headerParameters(headerType: .tokenHeader) as! [String : String])
|
|
return (headerParameters(headerType: .tokenHeader) as! [String : String])
|
|
}
|
|
}
|