|
@@ -96,7 +96,7 @@ class SpecService extends BaseService
|
|
|
*/
|
|
|
public function cartesian(array $specIdArr)
|
|
|
{
|
|
|
- $specS = Spec::with("attrs")->whereIn("id", $specIdArr)->get();
|
|
|
+ $specS = Spec::with("attrs")->whereIn("id", $specIdArr)->where("is_custom", 0)->get();
|
|
|
|
|
|
$attrS = collect();
|
|
|
$cartesianProduct = new CartesianProduct();
|
|
@@ -105,7 +105,11 @@ class SpecService extends BaseService
|
|
|
$cartesianProduct->appendSet($spec->attrs->pluck("name")->toArray());
|
|
|
$attrS = $attrS->merge($spec->attrs);
|
|
|
}
|
|
|
+ // TODO 这个第三方库有问题,如果只有一个规格的时候,格式不同要兼容一下
|
|
|
$cartesian = $cartesianProduct->compute();
|
|
|
+ if ($specS->count() == 1) {
|
|
|
+ $cartesian = [$cartesian];
|
|
|
+ }
|
|
|
|
|
|
foreach ($cartesian as $c) {
|
|
|
|