Browse Source

上班带餐

master
weigang 5 years ago
parent
commit
30ec2db49c
  1. 10
      app/Controller/v3/GoodsRecommendController.php

10
app/Controller/v3/GoodsRecommendController.php

@ -5,6 +5,7 @@ namespace App\Controller\v3;
use App\Constants\v3\Tabs;
use App\Controller\BaseController;
use App\Model\v3\Goods;
use App\Model\v3\GoodsCategory;
/**
* 推荐商品相关
@ -45,7 +46,14 @@ class GoodsRecommendController extends BaseController
$builder = $builder->orderBy('price', 'asc');
break;
case Tabs::APPLET_INDEX_OFFICE:
$builder = $builder->whereIn('category_id', [142,146]);
$categoryIds = [97,98];
var_dump('ids', $categoryIds);
// 查询出三级分类
$goodsCategoryIds = GoodsCategory::query()->whereIn('category_id', $categoryIds)->pluck('id');
$builder = $builder->where(function ($query) use ($categoryIds, $goodsCategoryIds) {
$query->whereIn('category_id', $categoryIds)
->orWhereIn('goods_category_id', $goodsCategoryIds);
});
break;
}

Loading…
Cancel
Save