// 帅选 品牌 规格 属性 价格
$cat_id_arr = getCatGrandson ($id);
$goods_where = ['is_on_sale' => 1, 'exchange_integral' => 0,'cat_id'=>['in',$cat_id_arr]];
$filter_goods_id = Db::name('goods')->where($goods_where)->cache(true)->getField("goods_id",true);
// 过滤帅选的结果集里面找商品
if($brand_id || $price)// 品牌或者价格
{
$goods_id_1 = $goodsLogic->getGoodsIdByBrandPrice($brand_id,$price); // 根据 品牌 或者 价格范围 查找所有商品id
$filter_goods_id = array_intersect($filter_goods_id,$goods_id_1); // 获取多个帅选条件的结果 的交集
}
if($spec)// 规格
{
$goods_id_2 = $goodsLogic->getGoodsIdBySpec($spec); // 根据 规格 查找当所有商品id
$filter_goods_id = array_intersect($filter_goods_id,$goods_id_2); // 获取多个帅选条件的结果 的交集
}
if($attr)// 属性
{
$goods_id_3 = $goodsLogic->getGoodsIdByAttr($attr); // 根据 规格 查找当所有商品id
key | 5d2bbabb1d85c25320c041ddd1993793 |
html | false |
filter_param | { "id": 1, "brand_id": "17" } |
id | 1 |
brand_id | 17 |
spec | 0 |
attr | |
sort | goods_id |
sort_asc | asc |
price | |
start_price | 0 |
end_price | 0 |
goodsLogic | [] |
goodsCate | { "id": 1, "name": "\u8155\u8868", "mobile_name": "\u8155\u8868", "parent_id": 0, "parent_id_path": "0_1", "level": 1, "sort_order": 0, "is_show": 1, "image": "", "is_hot": 1, "cat_group": 0, "commission_rate": 0, "parent_name": "\u8155\u8868", "select_id": 0 } |
cateArr | [ { "id": 4, "name": "\u8fea\u897f\u6b27", "mobile_name": "\u8fea\u897f\u6b27", "parent_id": 1, "parent_id_path": "0_1_4", "level": 2, "sort_order": 0, "is_show": 1, "image": "\/public\/upload\/category\/2020\/04-01\/99780de7e6ee8259d2f5f11510ea65c9.jpg", "is_hot": 0, "cat_group": 0, "commission_rate": 0, "sub_menu": [] } ] |
cat_id_arr | [ 1, 3, 4 ] |
goods_where | { "is_on_sale": 1, "exchange_integral": 0, "cat_id": [ "in", [ 1, 3, 4 ] ] } |
filter_goods_id | Resource |
goods_id_1 | [] |