Jelajahi Sumber

多颜色数据整理

shish 3 tahun lalu
induk
melakukan
a4a47d68b5
1 mengubah file dengan 21 tambahan dan 0 penghapusan
  1. 21 0
      app-ghs/controllers/OrderController.php

+ 21 - 0
app-ghs/controllers/OrderController.php

@@ -905,6 +905,27 @@ class OrderController extends BaseController
             }
         }
 
+        //多颜色数据整理
+        $colorItem = $post['xj'] ?? [];
+        $newXj = [];
+        if (!empty($colorItem)) {
+            $colorData = json_decode($colorItem, true);
+            if (!empty($colorData) && is_array($colorData)) {
+                foreach ($colorData as $colorInfo) {
+                    if (!empty($colorList)) {
+                        $ptItemId = $colorInfo['ptItemId'];
+                        $colorList = $colorInfo['list'];
+                        if (!empty($colorList)) {
+                            foreach ($colorList as $colorItemKey => $colorItem) {
+                                $newXj[$ptItemId][] = $colorItem;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        $post['xj'] = $newXj;
+
         $productJson = $post['product'] ?? '';
         if (empty($productJson)) {
             util::fail('请选择花材');