获取分页数列表
This commit is contained in:
parent
421c73fe7e
commit
79f6f77e2d
|
|
@ -67,6 +67,21 @@ class CategoryRepo
|
||||||
return DB::select($sql);
|
return DB::select($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成每页产品数列表, 客户可以自己选择如何分页
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getPerPages(): array
|
||||||
|
{
|
||||||
|
$perPages = [];
|
||||||
|
$configPerPage = system_setting('base.product_per_page', 20);
|
||||||
|
for ($index = 1; $index <= 5; $index++) {
|
||||||
|
$perPages[] = $configPerPage * $index;
|
||||||
|
}
|
||||||
|
return $perPages;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取顶级及其子分类
|
* 获取顶级及其子分类
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ class CategoryController extends Controller
|
||||||
'filter_data' => ['attr' => ProductRepo::getFilterAttribute($filterData), 'price' => ProductRepo::getFilterPrice($filterData)],
|
'filter_data' => ['attr' => ProductRepo::getFilterAttribute($filterData), 'price' => ProductRepo::getFilterPrice($filterData)],
|
||||||
'products_format' => $products->jsonSerialize(),
|
'products_format' => $products->jsonSerialize(),
|
||||||
'products' => $products,
|
'products' => $products,
|
||||||
|
'per_pages' => CategoryRepo::getPerPages(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('category', $data);
|
return view('category', $data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue