|
@@ -408,6 +408,48 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // MARK: - 新增商品评价
|
|
|
+ /// 新增商品评价
|
|
|
+ ///
|
|
|
+ /// - Parameters:
|
|
|
+ /// - completion: 回调
|
|
|
+ func productAddCommentApi(paraMdl:OrderCommentParameterModel, completion: @escaping apiCallBack) {
|
|
|
+ var parameters = Dictionary<String,Any>()
|
|
|
+ parameters.updateValue(paraMdl.purchase_id ?? 0, forKey: "purchase_id")
|
|
|
+ parameters.updateValue(paraMdl.username ?? "", forKey: "username")
|
|
|
+ parameters.updateValue(paraMdl.avatar ?? "", forKey: "avatar")
|
|
|
+ parameters.updateValue(paraMdl.purchase_no ?? "", forKey: "purchase_no")
|
|
|
+ parameters.updateValue(paraMdl.shop_id ?? 0, forKey: "shop_id")
|
|
|
+ parameters.updateValue(paraMdl.shop_name ?? "", forKey: "shop_name")
|
|
|
+
|
|
|
+ // 处理Json字符串
|
|
|
+ var detailDicArr = Array<Any>()
|
|
|
+ for orderDetailMdl: OrderModelDetailModel in paraMdl.cmtProductArr! {
|
|
|
+ var shopDic = Dictionary<String,Any>()
|
|
|
+ shopDic.updateValue(orderDetailMdl.id ?? 0, forKey: "purchase_detail_id")
|
|
|
+ shopDic.updateValue(orderDetailMdl.imageArrUrlStr, forKey: "imgs")
|
|
|
+ shopDic.updateValue(orderDetailMdl.comment, forKey: "content")
|
|
|
+ shopDic.updateValue(orderDetailMdl.starValue, forKey: "star")
|
|
|
+ shopDic.updateValue(orderDetailMdl.skuId ?? 0, forKey: "sku_id")
|
|
|
+ shopDic.updateValue(orderDetailMdl.skuName ?? "", forKey: "sku_name")
|
|
|
+ shopDic.updateValue(orderDetailMdl.productId ?? 0, forKey: "product_id")
|
|
|
+ shopDic.updateValue(orderDetailMdl.productName ?? "", forKey: "product_name")
|
|
|
+ shopDic.updateValue(orderDetailMdl.productName ?? "", forKey: "sale_name")
|
|
|
+ shopDic.updateValue(orderDetailMdl.categoryName1 ?? "", forKey: "category_name1")
|
|
|
+ shopDic.updateValue(orderDetailMdl.categoryName2 ?? "", forKey: "category_name2")
|
|
|
+ shopDic.updateValue(orderDetailMdl.categoryName3 ?? "", forKey: "category_name3")
|
|
|
+ detailDicArr.append(shopDic)
|
|
|
+ }
|
|
|
+ let jsonStr = JSON(detailDicArr).description
|
|
|
+ parameters.updateValue(jsonStr, forKey: "content")
|
|
|
+
|
|
|
+ SwiftProgressHUD.shared().showWait()
|
|
|
+ SwiftMoyaNetWorkManager.shared().requestArray(target: MultiTarget(SwiftMoyaServiceProductApi.productAddComment(parameters: parameters))) { (dataArr) in
|
|
|
+ SwiftProgressHUD.shared().hide()
|
|
|
+ completion(dataArr)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// MARK: - 获取购物车商品个数
|
|
|
/// 获取购物车商品个数
|
|
|
///
|