修改搜索关键词的模糊查询
This commit is contained in:
parent
d053e2818a
commit
7b38c5f606
@ -491,6 +491,9 @@ class GoodsLogic extends Logic
|
||||
second_cate_id,third_cate_id,sort_weight,brand_id,shop_id,sales_virtual,
|
||||
(sales_actual + sales_virtual) as sales_total,purchase_price,issuing_price';
|
||||
|
||||
// dump($wh);
|
||||
// dump($where);
|
||||
// dump($order);die;
|
||||
$list = Goods::with(['shop'])
|
||||
->field($field)
|
||||
->where($wh)
|
||||
@ -498,6 +501,7 @@ class GoodsLogic extends Logic
|
||||
->order($order)
|
||||
->page($get['page_no'], $get['page_size'])
|
||||
->select();
|
||||
|
||||
$set_price_type = 0;
|
||||
foreach ($list as $item) {
|
||||
$item['shop_type'] = $item['shop']['type'];
|
||||
@ -867,6 +871,12 @@ class GoodsLogic extends Logic
|
||||
'audit_status' => GoodsEnum::AUDIT_STATUS_OK, // 审核通过
|
||||
];
|
||||
|
||||
$where = [];
|
||||
if (!empty(self::filterShopsIds())) {
|
||||
// 过滤已删除、已冻结、已暂停营业、已到期的店铺
|
||||
$where[] = ['shop_id', 'not in', self::filterShopsIds()];
|
||||
}
|
||||
|
||||
$where[] = ['name', 'like', '%' . trim($shop_name) . '%'];
|
||||
|
||||
SearchRecord::create([
|
||||
@ -880,7 +890,7 @@ class GoodsLogic extends Logic
|
||||
$goods = Goods::field('id, name')
|
||||
->where($onSaleWhere)
|
||||
->where($where)
|
||||
->order('id desc')
|
||||
->order('sort_weight asc, sort asc, id desc')
|
||||
->select()->toArray();
|
||||
if ($goods) {
|
||||
return $goods;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user