|
@@ -165,11 +165,12 @@ class ProgressChapterController extends Controller
|
|
|
*/
|
|
*/
|
|
|
$chapters = ProgressChapter::select('channel_id')
|
|
$chapters = ProgressChapter::select('channel_id')
|
|
|
->selectRaw('count(*) as count')
|
|
->selectRaw('count(*) as count')
|
|
|
- ->with(['channel' => function($query) { //city对应上面province模型中定义的city方法名 闭包内是子查询
|
|
|
|
|
|
|
+ ->with(['channel' => function($query) {
|
|
|
return $query->select('*');
|
|
return $query->select('*');
|
|
|
}])
|
|
}])
|
|
|
->leftJoin('channels','progress_chapters.channel_id', '=', 'channels.uid')
|
|
->leftJoin('channels','progress_chapters.channel_id', '=', 'channels.uid')
|
|
|
- ->where("progress",">",$minProgress);
|
|
|
|
|
|
|
+ ->where("progress",">",$minProgress)
|
|
|
|
|
+ ->where('channels.status','>=',30);
|
|
|
if(!empty($request->get('channel_type'))){
|
|
if(!empty($request->get('channel_type'))){
|
|
|
$chapters = $chapters->where('channels.type',$request->get('channel_type'));
|
|
$chapters = $chapters->where('channels.type',$request->get('channel_type'));
|
|
|
}
|
|
}
|
|
@@ -250,6 +251,7 @@ class ProgressChapterController extends Controller
|
|
|
$channel = "";
|
|
$channel = "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
$param[] = $minProgress;
|
|
$param[] = $minProgress;
|
|
@@ -260,28 +262,43 @@ class ProgressChapterController extends Controller
|
|
|
}else{
|
|
}else{
|
|
|
$whereLang = " ";
|
|
$whereLang = " ";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if($request->has('channel_type') && !empty($request->get('channel_type'))){
|
|
|
|
|
+ $channel_type = "and ch.type = ? ";
|
|
|
|
|
+ $param[] = $request->get('channel_type');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $channel_type = "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$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.pc_uid as 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 (
|
|
|
- select * from (
|
|
|
|
|
- select anchor_id as cid from (
|
|
|
|
|
- select tm.anchor_id , count(*) as co
|
|
|
|
|
- from $tm as tm
|
|
|
|
|
- left join $tg as t on tm.tag_id = t.id
|
|
|
|
|
- where tm.table_name = 'progress_chapters'
|
|
|
|
|
- $in1
|
|
|
|
|
- group by tm.anchor_id
|
|
|
|
|
- ) T
|
|
|
|
|
- $where1
|
|
|
|
|
- ) CID
|
|
|
|
|
- left join $pc as pc on CID.cid = pc.uid
|
|
|
|
|
- where pc.progress > ?
|
|
|
|
|
- $channel $whereLang
|
|
|
|
|
- order by created_at desc
|
|
|
|
|
|
|
+ select pcd.uid as pc_uid, ch.uid as ch_uid, book , para, channel_id,progress, title ,pcd.summary , pcd.created_at,pcd.updated_at
|
|
|
|
|
+ from (
|
|
|
|
|
+ select uid, book,para,lang,progress,channel_id,title,summary ,created_at ,updated_at
|
|
|
|
|
+ from (
|
|
|
|
|
+ select anchor_id as cid
|
|
|
|
|
+ from (
|
|
|
|
|
+ select tm.anchor_id , count(*) as co
|
|
|
|
|
+ from $tm as tm
|
|
|
|
|
+ left join $tg as t on tm.tag_id = t.id
|
|
|
|
|
+ where tm.table_name = 'progress_chapters'
|
|
|
|
|
+ $in1
|
|
|
|
|
+ group by tm.anchor_id
|
|
|
|
|
+ ) T
|
|
|
|
|
+ $where1
|
|
|
|
|
+ ) CID
|
|
|
|
|
+ left join $pc as pc on CID.cid = pc.uid
|
|
|
|
|
+ where pc.progress > ?
|
|
|
|
|
+ $channel $whereLang
|
|
|
|
|
+ ) pcd
|
|
|
|
|
+ left join channels as ch on pcd.channel_id = ch.uid
|
|
|
|
|
+ where ch.status >= 30 $channel_type
|
|
|
|
|
+ order by pcd.created_at desc
|
|
|
limit 20 offset ?
|
|
limit 20 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;";
|
|
@@ -299,20 +316,28 @@ class ProgressChapterController extends Controller
|
|
|
|
|
|
|
|
//计算按照这个条件搜索到的总数
|
|
//计算按照这个条件搜索到的总数
|
|
|
$query = "
|
|
$query = "
|
|
|
- select count(*) as count from (
|
|
|
|
|
- select anchor_id as cid from (
|
|
|
|
|
- select tm.anchor_id , count(*) as co
|
|
|
|
|
- from $tm as tm
|
|
|
|
|
- left join $tg as t on tm.tag_id = t.id
|
|
|
|
|
- where tm.table_name = 'progress_chapters'
|
|
|
|
|
- $in1
|
|
|
|
|
- group by tm.anchor_id
|
|
|
|
|
- ) T
|
|
|
|
|
- $where1
|
|
|
|
|
- ) CID
|
|
|
|
|
- left join $pc as pc on CID.cid = pc.uid
|
|
|
|
|
- where pc.progress > ?
|
|
|
|
|
- $channel $whereLang
|
|
|
|
|
|
|
+ select count(*) as count
|
|
|
|
|
+ from (
|
|
|
|
|
+ select *
|
|
|
|
|
+ from (
|
|
|
|
|
+ select anchor_id as cid
|
|
|
|
|
+ from (
|
|
|
|
|
+ select tm.anchor_id , count(*) as co
|
|
|
|
|
+ from $tm as tm
|
|
|
|
|
+ left join $tg as t on tm.tag_id = t.id
|
|
|
|
|
+ where tm.table_name = 'progress_chapters'
|
|
|
|
|
+ $in1
|
|
|
|
|
+ group by tm.anchor_id
|
|
|
|
|
+ ) T
|
|
|
|
|
+ $where1
|
|
|
|
|
+ ) CID
|
|
|
|
|
+ left join $pc as pc on CID.cid = pc.uid
|
|
|
|
|
+ where pc.progress > ?
|
|
|
|
|
+ $channel $whereLang
|
|
|
|
|
+ ) pcd
|
|
|
|
|
+ left join channels as ch on pcd.channel_id = ch.uid
|
|
|
|
|
+ where ch.status >= 30 $channel_type
|
|
|
|
|
+
|
|
|
";
|
|
";
|
|
|
$count = DB::select($query,$param_count);
|
|
$count = DB::select($query,$param_count);
|
|
|
$all_count = $count[0]->count;
|
|
$all_count = $count[0]->count;
|