6
0
Fork 0
panliang 2023-02-15 17:00:56 +08:00
parent 13f30fbe5d
commit a797412fd7
1 changed files with 8 additions and 4 deletions

View File

@ -42,11 +42,15 @@ class StoreController extends Controller
$input['sort'] = '-id';
}
$spuIds = StoreProductSku::where('store_id', $store->id)->where('status', 1)->pluck('product_spu_id')->toArray();
$spuIds = array_unique($spuIds);
$spuIds = array_values($spuIds);
// $spuIds = StoreProductSku::where('store_id', $store->id)->where('status', 1)->pluck('product_spu_id')->toArray();
// $spuIds = array_unique($spuIds);
// $spuIds = array_values($spuIds);
$list = ProductSpu::with(['specs'])->filter($input)->whereIn('id', $spuIds)->simplePaginate(Paginator::resolvePerPage('per_page', 20, 50));
$list = $store->productSpus()
->with(['specs'])
->filter($input)
->wherePivot('status', 1)
->simplePaginate(Paginator::resolvePerPage('per_page', 20, 50));
return StoreProductSpuResource::collection($list);
}