瀏覽代碼

首页增加类型,小程序类型的筛选

liuzejian 1 年之前
父節點
當前提交
d6a95d96b0
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      modules/Operation/Http/Controllers/FirstPageController.php

+ 7 - 0
modules/Operation/Http/Controllers/FirstPageController.php

@@ -22,7 +22,14 @@ class FirstPageController extends CatchController
     public function list(Request $request) {
         $firstPageListTypeMap = CommonConfigService::getFirstPageListTypeMap();
         $miniprogramTypeMap = CommonConfigService::getMiniprogramTypeMap();
+        $miniprogramType = $request->input('miniprogram_type');
+        $firstPageListType = $request->input('type');
         $result = DB::table('first_pages')
+            ->when($miniprogramType, function ($query, $miniprogramType){
+                return $query->where('miniprogram_type', $miniprogramType);
+            })->when($firstPageListType, function ($query, $firstPageListType){
+                return $query->where('type', $firstPageListType);
+            })
             ->orderBy('id', 'desc')
             ->paginate($request->input('limit', 15));
         foreach ($result as $item) {