修复前台选择每页数量后翻页问题
This commit is contained in:
parent
b61c8cf9b6
commit
9579ae8c08
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Beike\Models\AdminUser;
|
use Beike\Models\AdminUser;
|
||||||
|
use Beike\Models\Currency;
|
||||||
use Beike\Models\Customer;
|
use Beike\Models\Customer;
|
||||||
use Beike\Models\Language;
|
use Beike\Models\Language;
|
||||||
use Beike\Models\Currency;
|
|
||||||
use Beike\Repositories\BrandRepo;
|
use Beike\Repositories\BrandRepo;
|
||||||
use Beike\Repositories\CategoryRepo;
|
use Beike\Repositories\CategoryRepo;
|
||||||
use Beike\Repositories\CurrencyRepo;
|
use Beike\Repositories\CurrencyRepo;
|
||||||
|
|
@ -341,7 +341,6 @@ function currency_format($price, string $currency = '', string $value = '', bool
|
||||||
return CurrencyService::getInstance()->format($price, $currency, $value, $format);
|
return CurrencyService::getInstance()->format($price, $currency, $value, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定货币汇率
|
* 获取指定货币汇率
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ use Beike\Models\ProductDescription;
|
||||||
use Beike\Models\ProductRelation;
|
use Beike\Models\ProductRelation;
|
||||||
use Beike\Models\ProductSku;
|
use Beike\Models\ProductSku;
|
||||||
use Beike\Shop\Http\Resources\ProductSimple;
|
use Beike\Shop\Http\Resources\ProductSimple;
|
||||||
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\HigherOrderBuilderProxy;
|
use Illuminate\Database\Eloquent\HigherOrderBuilderProxy;
|
||||||
|
|
@ -46,14 +47,16 @@ class ProductRepo
|
||||||
* 通过单个或多个商品分类获取商品列表
|
* 通过单个或多个商品分类获取商品列表
|
||||||
*
|
*
|
||||||
* @param $categoryId
|
* @param $categoryId
|
||||||
* @return
|
* @param $filterData
|
||||||
|
* @return LengthAwarePaginator
|
||||||
*/
|
*/
|
||||||
public static function getProductsByCategory($categoryId, $filterData)
|
public static function getProductsByCategory($categoryId, $filterData)
|
||||||
{
|
{
|
||||||
$builder = self::getBuilder(array_merge(['category_id' => $categoryId, 'active' => 1], $filterData));
|
$builder = self::getBuilder(array_merge(['category_id' => $categoryId, 'active' => 1], $filterData));
|
||||||
$products = $builder->with('inCurrentWishlist')->paginate($filterData['per_page'] ?? perPage());
|
|
||||||
|
|
||||||
return $products;
|
return $builder->with('inCurrentWishlist')
|
||||||
|
->paginate($filterData['per_page'] ?? perPage())
|
||||||
|
->withQueryString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,10 @@ class RmaController extends Controller
|
||||||
*/
|
*/
|
||||||
public function show(int $id)
|
public function show(int $id)
|
||||||
{
|
{
|
||||||
$rma = RmaRepo::find($id);
|
$rma = RmaRepo::find($id);
|
||||||
$statuses = RmaRepo::getStatuses();
|
$statuses = RmaRepo::getStatuses();
|
||||||
$rma->status = $statuses[$rma->status];
|
$rma->status = $statuses[$rma->status];
|
||||||
$data = [
|
$data = [
|
||||||
'rma' => $rma,
|
'rma' => $rma,
|
||||||
'orderProduct' => OrderProductRepo::find($rma->order_product_id),
|
'orderProduct' => OrderProductRepo::find($rma->order_product_id),
|
||||||
'statuses' => RmaRepo::getStatuses(),
|
'statuses' => RmaRepo::getStatuses(),
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,10 @@ class CategoryController extends Controller
|
||||||
$data = [
|
$data = [
|
||||||
'all_categories' => CategoryRepo::getTwoLevelCategories(),
|
'all_categories' => CategoryRepo::getTwoLevelCategories(),
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
'filter_data' => ['attr' => ProductRepo::getFilterAttribute($filterData), 'price' => ProductRepo::getFilterPrice($filterData)],
|
'filter_data' => [
|
||||||
|
'attr' => ProductRepo::getFilterAttribute($filterData),
|
||||||
|
'price' => ProductRepo::getFilterPrice($filterData),
|
||||||
|
],
|
||||||
'products_format' => ProductSimple::collection($products)->jsonSerialize(),
|
'products_format' => ProductSimple::collection($products)->jsonSerialize(),
|
||||||
'products' => $products,
|
'products' => $products,
|
||||||
'per_pages' => CategoryRepo::getPerPages(),
|
'per_pages' => CategoryRepo::getPerPages(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue