更新查询条件

This commit is contained in:
yaooo 2023-08-21 14:49:27 +08:00
parent 9522cece8b
commit b3565d0a76
2 changed files with 6 additions and 0 deletions

View File

@ -151,6 +151,9 @@ class ProductDao extends BaseDao
});
}
})
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
$query->whereLike('Product.keyword', "%{$where['keyword']}%");
})
->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) {
$query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%");
})

View File

@ -2447,6 +2447,9 @@ class ProductRepository extends BaseRepository
unset($where['uid']);
$where['status'] = 1;
$where['is_show'] = 1;
if (!empty($keyword)) {
$where['keyword'] = $keyword;
}
$query = $this->dao->search($merId, $where)->with(['merCateId.category', 'storeCategory', 'brand', 'attrValue']);
$count = $query->count();
$data = $query->page($page, $limit)->setOption('field', [])->field($this->filed)->select();