|
@@ -149,6 +149,7 @@ class ProgressChapterController extends Controller
|
|
|
$all_count = count($chapters);
|
|
$all_count = count($chapters);
|
|
|
break;
|
|
break;
|
|
|
case 'lang':
|
|
case 'lang':
|
|
|
|
|
+
|
|
|
$chapters = ProgressChapter::select('lang')
|
|
$chapters = ProgressChapter::select('lang')
|
|
|
->selectRaw('count(*) as count')
|
|
->selectRaw('count(*) as count')
|
|
|
->where("progress",">",$minProgress)
|
|
->where("progress",">",$minProgress)
|
|
@@ -163,12 +164,19 @@ class ProgressChapterController extends Controller
|
|
|
总共有多少channel
|
|
总共有多少channel
|
|
|
*/
|
|
*/
|
|
|
$chapters = ProgressChapter::select('channel_id')
|
|
$chapters = ProgressChapter::select('channel_id')
|
|
|
- ->selectRaw('count(*) as count')
|
|
|
|
|
- ->with(['channel' => function($query) { //city对应上面province模型中定义的city方法名 闭包内是子查询
|
|
|
|
|
|
|
+ ->selectRaw('count(*) as count')
|
|
|
|
|
+ ->with(['channel' => function($query) { //city对应上面province模型中定义的city方法名 闭包内是子查询
|
|
|
return $query->select('*');
|
|
return $query->select('*');
|
|
|
}])
|
|
}])
|
|
|
- ->where("progress",">",$minProgress)
|
|
|
|
|
- ->groupBy('channel_id')
|
|
|
|
|
|
|
+ ->leftJoin('channels','progress_chapters.channel_id', '=', 'channels.uid')
|
|
|
|
|
+ ->where("progress",">",$minProgress);
|
|
|
|
|
+ if(!empty($request->get('channel_type'))){
|
|
|
|
|
+ $chapters = $chapters->where('channels.type',$request->get('channel_type'));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!empty($request->get('lang'))){
|
|
|
|
|
+ $chapters = $chapters->where('progress_chapters.lang',$request->get('lang'));
|
|
|
|
|
+ }
|
|
|
|
|
+ $chapters = $chapters->groupBy('channel_id')
|
|
|
->orderBy('count','desc')
|
|
->orderBy('count','desc')
|
|
|
->get();
|
|
->get();
|
|
|
$all_count = count($chapters);
|
|
$all_count = count($chapters);
|
|
@@ -242,9 +250,20 @@ class ProgressChapterController extends Controller
|
|
|
$channel = "";
|
|
$channel = "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$param[] = $minProgress;
|
|
$param[] = $minProgress;
|
|
|
|
|
+
|
|
|
|
|
+ if(!empty($request->get('lang'))){
|
|
|
|
|
+ $whereLang = " and pc.lang = ? ";
|
|
|
|
|
+ $param[] = $request->get('lang');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $whereLang = " ";
|
|
|
|
|
+ }
|
|
|
$param_count = $param;
|
|
$param_count = $param;
|
|
|
$param[] = $offset;
|
|
$param[] = $offset;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$query = "
|
|
$query = "
|
|
|
select tpc.uid, tpc.book ,tpc.para,tpc.channel_id,tpc.title,pt.toc,pt.path,tpc.progress,tpc.summary,tpc.created_at,tpc.updated_at
|
|
select tpc.uid, tpc.book ,tpc.para,tpc.channel_id,tpc.title,pt.toc,pt.path,tpc.progress,tpc.summary,tpc.created_at,tpc.updated_at
|
|
|
from (
|
|
from (
|
|
@@ -261,7 +280,7 @@ class ProgressChapterController extends Controller
|
|
|
) CID
|
|
) CID
|
|
|
left join $pc as pc on CID.cid = pc.uid
|
|
left join $pc as pc on CID.cid = pc.uid
|
|
|
where pc.progress > ?
|
|
where pc.progress > ?
|
|
|
- $channel
|
|
|
|
|
|
|
+ $channel $whereLang
|
|
|
order by created_at desc
|
|
order by created_at desc
|
|
|
limit 20 offset ?
|
|
limit 20 offset ?
|
|
|
) tpc
|
|
) tpc
|
|
@@ -293,7 +312,7 @@ class ProgressChapterController extends Controller
|
|
|
) CID
|
|
) CID
|
|
|
left join $pc as pc on CID.cid = pc.uid
|
|
left join $pc as pc on CID.cid = pc.uid
|
|
|
where pc.progress > ?
|
|
where pc.progress > ?
|
|
|
- $channel
|
|
|
|
|
|
|
+ $channel $whereLang
|
|
|
";
|
|
";
|
|
|
$count = DB::select($query,$param_count);
|
|
$count = DB::select($query,$param_count);
|
|
|
$all_count = $count[0]->count;
|
|
$all_count = $count[0]->count;
|