From 47f525d04010db9a02656470d54be20dabd08eec Mon Sep 17 00:00:00 2001 From: Anyon Date: Sat, 21 Apr 2018 14:47:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=E4=BF=AE=E6=94=B9=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/goods/controller/Product.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/goods/controller/Product.php b/application/goods/controller/Product.php index 1c0042f75..3dea62704 100644 --- a/application/goods/controller/Product.php +++ b/application/goods/controller/Product.php @@ -50,8 +50,11 @@ class Product extends BasicAdmin $this->title = '产品管理'; $get = $this->request->get(); $db = Db::name($this->table)->where(['is_deleted' => '0']); - foreach (['tags_id', 'goods_title'] as $field) { - (isset($get[$field]) && $get[$field] !== '') && $db->whereLike($field, "%,{$get[$field]},%"); + if (isset($get['tags_id']) && $get['tags_id'] !== '') { + $db->whereLike('tags_id', "%,{$get['tags_id']},%"); + } + if (isset($get['goods_title']) && $get['goods_title'] !== '') { + $db->whereLike('goods_title', "%{$get['goods_title']}%"); } foreach (['cate_id', 'brand_id'] as $field) { (isset($get[$field]) && $get[$field] !== '') && $db->where($field, $get[$field]);