更新查询商品

This commit is contained in:
yaooo 2023-09-27 13:53:30 +08:00
parent 711eebfc93
commit deedafe21f

View File

@ -117,6 +117,7 @@ class ProductDao extends BaseDao
$whereArr[$key] = $item; $whereArr[$key] = $item;
} }
} }
// halt($where);
$query = isset($where['soft']) ? model::onlyTrashed()->alias('Product') : model::alias('Product'); $query = isset($where['soft']) ? model::onlyTrashed()->alias('Product') : model::alias('Product');
if (isset($where['is_trader']) && $where['is_trader'] !== '') { if (isset($where['is_trader']) && $where['is_trader'] !== '') {
$query->hasWhere('merchant', function ($query) use ($where) { $query->hasWhere('merchant', function ($query) use ($where) {
@ -152,7 +153,7 @@ class ProductDao extends BaseDao
} }
}) })
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) { ->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
$query->whereLike('Product.keyword', "%{$where['keyword']}%"); $query->whereLike('Product.store_name', "%{$where['keyword']}%");
}) })
->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) { ->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) {
$query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%"); $query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%");