From 81d6fcf7a0ec415faee7c3478601129f1eb1ea85 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Fri, 5 Aug 2022 16:49:54 +0800 Subject: [PATCH] setter --- app/controller/manager/mall/Spu.php | 4 +++- app/repository/SpuRepository.php | 5 +++-- view/manager/mall/spu/index.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controller/manager/mall/Spu.php b/app/controller/manager/mall/Spu.php index 95a13a2..75527df 100755 --- a/app/controller/manager/mall/Spu.php +++ b/app/controller/manager/mall/Spu.php @@ -33,7 +33,9 @@ class Spu extends Base public function index() { if ($this->request->isPost()) { - $params = input(); + $params = input("searchParams/a"); + $params["page"] = input("page/d",1); + $params["size"] = input("size/d",20); $res = SpuRepository::getInstance()->list($params); diff --git a/app/repository/SpuRepository.php b/app/repository/SpuRepository.php index 25bfc15..4ceed65 100755 --- a/app/repository/SpuRepository.php +++ b/app/repository/SpuRepository.php @@ -74,7 +74,7 @@ class SpuRepository extends Repository // $whereMap[] = ['is_activity', '=', Spu::COMMON_OFF]; } - if (isset($params['saleable'])) { + if (isset($params['saleable']) &&!empty( $params['saleable'])) { $whereMap[] = ['saleable', '=', $params['saleable']]; } @@ -88,6 +88,7 @@ class SpuRepository extends Repository $whereMap[] = ['deleted_at', '=', null]; + $params['page'] = $params['page'] ?? 1; $params['size'] = $params['size'] ?? 20; @@ -113,7 +114,7 @@ class SpuRepository extends Repository $whereMap[] = ['activity_type', '=', $type]; } - if (isset($params['saleable'])) { + if (isset($params['saleable'])&&!empty( $params['saleable'])) { $whereMap[] = ['saleable', '=', $params['saleable']]; } diff --git a/view/manager/mall/spu/index.html b/view/manager/mall/spu/index.html index a0aa0dd..58e028e 100755 --- a/view/manager/mall/spu/index.html +++ b/view/manager/mall/spu/index.html @@ -21,7 +21,7 @@ -
+