kphcdr hace 1 año
padre
commit
8fa4e826f7

+ 1 - 1
app/Modules/Admin/Services/GoodsService.php

@@ -48,7 +48,7 @@ class GoodsService extends BaseService
             $goods = new Goods();
         }
 
-        $specIdArr = Arr::get($params, "spec", []);
+        $specIdArr = array_values(Arr::sort(Arr::get($params, "spec", [])));
         $notCustomSpecS = Spec::whereIn("id", $specIdArr)->where("is_custom", 0)->get();
         if ($notCustomSpecS->isEmpty()) {
             throw new ClientException("必须要存在一个非自定义的规格");

+ 0 - 1
app/Modules/Admin/Services/SpecService.php

@@ -107,7 +107,6 @@ class SpecService extends BaseService
             $cartesianProduct->appendSet($spec->attrs->pluck("name")->toArray());
             $attrS = $attrS->merge($spec->attrs);
         }
-        // TODO 这个第三方库有问题,如果只有一个规格的时候,格式不同要兼容一下
         $cartesian = $cartesianProduct->compute();
 
         foreach ($cartesian as $c) {