|
@@ -174,21 +174,43 @@ extension OrderCommentController {
|
|
|
SwiftProgressHUD.shared().showText("请给予商品评分")
|
|
|
return
|
|
|
}
|
|
|
-// if productMdl.comment == "" {
|
|
|
-// SwiftProgressHUD.shared().showText("请填写商品评价")
|
|
|
-// return
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
- DispatchQueue.global(qos: .userInitiated).async {
|
|
|
- self.uploadImages()
|
|
|
+// // test data
|
|
|
+// let testMdl: OrderModelDetailModel = (productArr?[0])!
|
|
|
+// productArr?.append(testMdl)
|
|
|
+// productArr?.append(testMdl)
|
|
|
+// productArr?.append(testMdl)
|
|
|
+ print("\n0----开始上传流程")
|
|
|
+ var times: Int = productArr?.count ?? 0
|
|
|
+ // 上传全部商品图片
|
|
|
+ for (idx, productMdl) in (productArr?.enumerated())! {
|
|
|
+ let curImageArr = productArr![idx].imageArr
|
|
|
+
|
|
|
+ if curImageArr.isEmpty {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ print("\n1----准备请求\(idx)")
|
|
|
+
|
|
|
+ // 多图上传Api
|
|
|
+ SwiftMoyaNetWorkServiceConfig.shared().configUploadMultiImgApi(imageArray: curImageArr) { (imgUrlArr) -> (Void) in
|
|
|
+ let imgJsonStr = JSON(imgUrlArr).description
|
|
|
+ productMdl.imageArrUrlStr = imgJsonStr
|
|
|
+ NXLLog("\n2----请求返回\(idx)")
|
|
|
+
|
|
|
+ // 需待最后一次请求返回后,再调用评价API
|
|
|
+ times -= 1
|
|
|
+ if times == 0 {
|
|
|
+ self.productAddCommentApi()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- self.productAddCommentApi()
|
|
|
+
|
|
|
}
|
|
|
|
|
|
func uploadImages() {
|
|
|
- print("----开始上传流程")
|
|
|
// 上传全部商品图片
|
|
|
for (idx, productMdl) in (productArr?.enumerated())! {
|
|
|
let curImageArr = productArr![idx].imageArr
|
|
@@ -212,8 +234,8 @@ extension OrderCommentController {
|
|
|
}
|
|
|
|
|
|
func productAddCommentApi() {
|
|
|
- print("----评价流程")
|
|
|
- return
|
|
|
+ print("3----评价流程")
|
|
|
+// return
|
|
|
|
|
|
let paraMdl = OrderCommentParameterModel()
|
|
|
paraMdl.purchase_id = orderDetailModel?.id
|