Explorar o código

fix: 生成多规格时,允许手动添加2021

joe %!s(int64=4) %!d(string=hai) anos
pai
achega
0ced869d18
Modificáronse 1 ficheiros con 10 adicións e 8 borrados
  1. 10 8
      app/admin/controller/store/StoreProduct.php

+ 10 - 8
app/admin/controller/store/StoreProduct.php

@@ -543,14 +543,16 @@ class StoreProduct extends AuthController
             return Json::fail('产品只能属于一个分类');
         }
         if ($cate_id == Config::get('activity.lucky_cate_id')) {
-            $data['attrs'][] = [
-                'value' => '幸运',
-                'detailValue' => '',
-                'attrHidden' => '',
-                'detail' => [
-                    20, 21
-                ],
-            ];
+            if (!array_search('幸运', array_column($data['attrs'], 'value'))) {
+                $data['attrs'][] = [
+                    'value' => '幸运',
+                    'detailValue' => '',
+                    'attrHidden' => '',
+                    'detail' => [
+                        20, 21
+                    ],
+                ];
+            }
         }
         $attr = $data['attrs'];
         $value = attr_format($attr)[1];