From c6a3e7792b82a64a270a1db542b1a7bef30ee53c Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Thu, 9 May 2024 17:47:17 +0800 Subject: [PATCH] =?UTF-8?q?YS:=E7=B1=BB=E5=88=AB=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/Goods.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/common/model/Goods.php b/app/common/model/Goods.php index d20b818c..ef94a21f 100644 --- a/app/common/model/Goods.php +++ b/app/common/model/Goods.php @@ -314,6 +314,12 @@ class Goods extends BaseModel if (!empty($param['keyword'])) { $query = $query->whereRaw('goods_name like ? or goods_no like ?', ["%{$param['keyword']}%", "%{$param['keyword']}%"]); } + if (!empty($param['keywords'])) { + $where = explode(',',$param['keywords']); + foreach ($where as $key => $val){ + $query = $query->whereRaw('goods_name like ? or goods_no like ?', ["%{$val}%", "%{$val}%"]); + } + } // 执行查询 $list = $query->with(['images.file']) ->alias($this->name)