shish há 4 anos atrás
pai
commit
0bc8583958
1 ficheiros alterados com 22 adições e 22 exclusões
  1. 22 22
      biz-hd/goods/classes/GoodsClass.php

+ 22 - 22
biz-hd/goods/classes/GoodsClass.php

@@ -317,28 +317,28 @@ class GoodsClass extends BaseClass
         } else {
             $itemList = $data['itemList'] ?? '';
             $itemArr = json_decode($itemList, true);
-            if (empty($itemArr)) {
-                util::fail('请选择花材');
-            }
-            foreach ($itemArr as $item) {
-                $goodsItemData = [
-                    'name' => $item['name'] ?? '',
-                    'cover' => $item['cover'] ?? '',
-                    'sjId' => $sjId,
-                    'shopId' => $shopId,
-                    'mainId' => $mainId,
-                    'goodsId' => $id,
-                    'itemId' => $item['id'] ?? 0,
-                    'ptItemId' => $item['ptItemId'] ?? 0,
-                    'num' => $item['num'] ?? 0,
-                    'count' => $item['count'] ?? 0,
-                    'ratio' => $item['ratio'] ?? 0,
-                    'bigName' => $item['bigName'] ?? '',
-                    'smallName' => $item['smallName'] ?? '',
-                    'unitType' => $item['unitType'] ?? 0,
-                    'unitName' => $item['unitName'] ?? '',
-                ];
-                GoodsItemClass::addData($goodsItemData);
+            //新建花束有子项,采购绿植没有子项
+            if (!empty($itemArr)) {
+                foreach ($itemArr as $item) {
+                    $goodsItemData = [
+                        'name' => $item['name'] ?? '',
+                        'cover' => $item['cover'] ?? '',
+                        'sjId' => $sjId,
+                        'shopId' => $shopId,
+                        'mainId' => $mainId,
+                        'goodsId' => $id,
+                        'itemId' => $item['id'] ?? 0,
+                        'ptItemId' => $item['ptItemId'] ?? 0,
+                        'num' => $item['num'] ?? 0,
+                        'count' => $item['count'] ?? 0,
+                        'ratio' => $item['ratio'] ?? 0,
+                        'bigName' => $item['bigName'] ?? '',
+                        'smallName' => $item['smallName'] ?? '',
+                        'unitType' => $item['unitType'] ?? 0,
+                        'unitName' => $item['unitName'] ?? '',
+                    ];
+                    GoodsItemClass::addData($goodsItemData);
+                }
             }
         }
         return $info;