Parcourir la source

增加limit 参数

visuddhinanda il y a 3 ans
Parent
commit
54d179f2ed
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      app/Http/Controllers/ProgressChapterController.php

+ 6 - 2
app/Http/Controllers/ProgressChapterController.php

@@ -36,7 +36,11 @@ class ProgressChapterController extends Controller
         }else{
         }else{
             $offset = 0;
             $offset = 0;
         }
         }
-
+        if($request->has('limit')){
+            $limit = (int)$request->get('limit');
+        }else{
+            $limit = 20;
+        }
         $channel_id = $request->get('channel');
         $channel_id = $request->get('channel');
 
 
         //
         //
@@ -311,7 +315,7 @@ class ProgressChapterController extends Controller
 						left join channels as ch on pcd.channel_id = ch.uid
 						left join channels as ch on pcd.channel_id = ch.uid
 						where ch.status >= 30 $channel_type
 						where ch.status >= 30 $channel_type
                         order by pcd.created_at desc
                         order by pcd.created_at desc
-                        limit 20 offset ?
+                        limit {$limit} offset ?
                     ) tpc
                     ) tpc
                     left join $pt as pt on tpc.book = pt.book and tpc.para = pt.paragraph;";
                     left join $pt as pt on tpc.book = pt.book and tpc.para = pt.paragraph;";
                 $chapters = DB::select($query,$param);
                 $chapters = DB::select($query,$param);