商品搜索添加商品分类搜索
This commit is contained in:
parent
edaad48c93
commit
f8d0e6d576
@ -413,6 +413,7 @@ class GoodsLogic extends Logic
|
|||||||
$where[] = ['shop_id', 'not in', self::filterShopsIds()];
|
$where[] = ['shop_id', 'not in', self::filterShopsIds()];
|
||||||
}
|
}
|
||||||
// 平台分类
|
// 平台分类
|
||||||
|
$get['platform_cate_id'] = 319;
|
||||||
if(isset($get['platform_cate_id']) && !empty($get['platform_cate_id']) && filter_var($get['platform_cate_id'], FILTER_VALIDATE_INT)) {
|
if(isset($get['platform_cate_id']) && !empty($get['platform_cate_id']) && filter_var($get['platform_cate_id'], FILTER_VALIDATE_INT)) {
|
||||||
$category_msg = GoodsCategory::where("id",$get['platform_cate_id'])->find();
|
$category_msg = GoodsCategory::where("id",$get['platform_cate_id'])->find();
|
||||||
if($category_msg['pid'] == 0){
|
if($category_msg['pid'] == 0){
|
||||||
@ -425,7 +426,20 @@ class GoodsLogic extends Logic
|
|||||||
$wh = "find_in_set(".$get['platform_cate_id'].", third_cate_id)";
|
$wh = "find_in_set(".$get['platform_cate_id'].", third_cate_id)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$whereIn = '';
|
||||||
|
if (isset($get['cate']) && $get['cate']) {
|
||||||
|
$cate = GoodsCategory::where(['is_show' => 1, 'del' => 0])
|
||||||
|
->where([['name', 'like', '%' . trim($get['keyword']) . '%']])
|
||||||
|
->field('id')
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$whereIn = array_map(function ($innerArray) {
|
||||||
|
return implode(',', $innerArray);
|
||||||
|
}, $cate);
|
||||||
|
$get['keyword'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 品牌
|
// 品牌
|
||||||
@ -522,6 +536,7 @@ class GoodsLogic extends Logic
|
|||||||
->field($field)
|
->field($field)
|
||||||
->where($wh)
|
->where($wh)
|
||||||
->where($where)
|
->where($where)
|
||||||
|
->whereIn('first_cate_id|second_cate_id|third_cate_id', $whereIn)
|
||||||
->order($order)
|
->order($order)
|
||||||
->page($get['page_no'], $get['page_size'])
|
->page($get['page_no'], $get['page_size'])
|
||||||
->select();
|
->select();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user