YS:类别不能搜索

es
yangsai@163.com 7 months ago
parent c0cae0d03d
commit c6a3e7792b
  1. 6
      app/common/model/Goods.php

@ -314,6 +314,12 @@ class Goods extends BaseModel
if (!empty($param['keyword'])) { if (!empty($param['keyword'])) {
$query = $query->whereRaw('goods_name like ? or goods_no like ?', ["%{$param['keyword']}%", "%{$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']) $list = $query->with(['images.file'])
->alias($this->name) ->alias($this->name)

Loading…
Cancel
Save