商品筛选

This commit is contained in:
TL 2023-01-11 11:49:15 +08:00
parent af58eb52f1
commit 9052087431
1 changed files with 4 additions and 1 deletions

View File

@ -221,12 +221,15 @@ class ProductRepo
public static function getFilterPrice($data)
{
$priceArr = explode('-', $data['price']);
unset($data['price']);
$builder = self::getBuilder($data)->leftJoin('product_skus as ps', 'products.id', 'ps.product_id')
->where('ps.is_default', 1);
return [
'min' => $builder->min('ps.price'),
'max' => $builder->max('ps.price'),
'select_min' => $priceArr[0],
'select_max' => $priceArr[1],
];
}