From 56dd08681684089469d9d575019d0fdd01012726 Mon Sep 17 00:00:00 2001 From: wang hou sheng <76928547+wanghousheng@users.noreply.github.com> Date: Tue, 7 May 2024 16:59:59 +0800 Subject: [PATCH] 1 --- app/api/controller/Goods.php | 3 +-- app/api/service/Goods.php | 2 +- app/common/model/Goods.php | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/api/controller/Goods.php b/app/api/controller/Goods.php index 118b92e0..b71ad6b0 100644 --- a/app/api/controller/Goods.php +++ b/app/api/controller/Goods.php @@ -296,8 +296,7 @@ class Goods extends Controller public function brandList(): Json { $service = new GoodsService; - $storeid = request()->header()['storeid']; - $goodsList = $service->brandList($storeid); + $goodsList = $service->brandList(); return $this->renderSuccess($goodsList); } diff --git a/app/api/service/Goods.php b/app/api/service/Goods.php index 32cc9cf6..f0a8712a 100644 --- a/app/api/service/Goods.php +++ b/app/api/service/Goods.php @@ -171,7 +171,7 @@ class Goods extends GoodsService } //大牌正品列表 - public function brandList($storeid) + public function brandList(): array { $model = new GoodsModel; $parmas = $this->request->get(); diff --git a/app/common/model/Goods.php b/app/common/model/Goods.php index fe13e20c..d20b818c 100644 --- a/app/common/model/Goods.php +++ b/app/common/model/Goods.php @@ -428,11 +428,11 @@ class Goods extends BaseModel !empty($params['goodsNo']) && $filter[] = ['goods_no', 'like', "%{$params['goodsNo']}%"]; //wmc - if (isset($param['is_brand']) && $param['is_brand'] !== '') { - $filter[] = ['is_brand', '=', $param['is_brand']]; + if (!empty($param['is_brand'])) { + $filter[] = ['is_brand', '=', intval($param['is_brand'])]; } - if (isset($param['is_new']) && $param['is_new'] !== '') { - $filter[] = ['is_new', '=', $param['is_new']]; + if (!empty($param['is_new'])) { + $filter[] = ['is_new', '=', intval($param['is_new'])]; } if (!empty($param['paihang'])) { $filter[] = ['paihang', '>', 0]; @@ -445,7 +445,7 @@ class Goods extends BaseModel if (isset($param['is_in_store']) && $param['is_in_store'] !== '') { $filter[] = ['is_in_store', '=', $params['is_in_store']]; } - + if (isset($param['store_id']) && $param['store_id'] !== '') { $filter[] = ['goods.store_id', '=', $params['store_id']]; }