Explorar el Código

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

liuzejian hace 1 año
padre
commit
d6a95d96b0
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  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) {