Kaynağa Gözat

Merge pull request #889 from visuddhinanda/chanpter_progress

增加channel 类型过滤
visuddhinanda 3 yıl önce
ebeveyn
işleme
91d1519f4b

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

@@ -251,6 +251,7 @@ class ProgressChapterController extends Controller
                     $channel = "";
                 }
 
+				
 
 
                 $param[] = $minProgress;
@@ -261,6 +262,14 @@ class ProgressChapterController extends Controller
                 }else{
                     $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[] = $offset;
 
@@ -288,7 +297,7 @@ class ProgressChapterController extends Controller
 								$channel  $whereLang
 							) pcd
 						left join channels as ch on pcd.channel_id = ch.uid
-						where ch.status >= 30
+						where ch.status >= 30 $channel_type
                         order by pcd.created_at desc
                         limit 20 offset ?
                     ) tpc 
@@ -327,7 +336,7 @@ class ProgressChapterController extends Controller
 								$channel   $whereLang
 							) pcd
 							left join channels as ch on pcd.channel_id = ch.uid
-							where ch.status >= 30
+							where ch.status >= 30 $channel_type
 
                 ";
                 $count = DB::select($query,$param_count);

+ 6 - 4
public/app/palicanon/palicanon.js

@@ -185,15 +185,17 @@ function updataHistory(){
 
 function communityGetChapter(offset=0){
     next_page_loader_show();
-    $.getJSON(
-		"/api/v2/progress?view=chapter",
-		{
+	let param = {
 			tags: _tags,
 			lang: _lang,
             channel: _channel,
             channel_type: _channelType,
             offset: offset
-		}
+		};
+	console.log("查询条件", param);
+    $.getJSON(
+		"/api/v2/progress?view=chapter",
+		param
 	)
     .done(function (data, status) {
             $("#filter_bar_left").html(data.data.count+"个章节");