Procházet zdrojové kódy

'过滤掉屏蔽cp及非上架书籍'

zhuchengjie před 2 roky
rodič
revize
7a2c5d8410

+ 10 - 2
app/Modules/Channel/Services/ChannelRecommendBooksService.php

@@ -11,7 +11,13 @@ class ChannelRecommendBooksService
 
     static function getChannelBid($channel_id)
     {
-        return ChannelRecommendBooks::where('channel_id',$channel_id)->orderBy('priority','DESC')->orderBy('created_at','DESC')->pluck('bid')->all();
+        return ChannelRecommendBooks::leftjoin('book_configs','book_configs.bid','channel_recommend_books.bid')
+            ->where('channel_recommend_books.channel_id',$channel_id)
+            ->whereNotIn('book_configs.cp_source',getHiddenCp())
+            ->whereIn('book_configs.is_on_shelf',[1,2])
+            ->orderBy('channel_recommend_books.priority','DESC')
+            ->orderBy('channel_recommend_books.created_at','DESC')
+            ->pluck('channel_recommend_books.bid')->all();
     }
 
     static function getMergerBids($channel_id,$bid)
@@ -57,7 +63,9 @@ class ChannelRecommendBooksService
             ->select('books.intro','books.category_name','book_configs.book_name','book_configs.cover','book_configs.bid','channel_recommend_books.priority')
             ->orderBy('channel_recommend_books.priority','DESC')->orderBy('channel_recommend_books.created_at','DESC');
 
-        $query->where('channel_recommend_books.channel_id',$channel_id)->whereIn('channel_recommend_books.bid',$bids);
+        $query->where('channel_recommend_books.channel_id',$channel_id)
+            ->whereIn('channel_recommend_books.bid',$bids);
+
 
         return $query->get()->toArray();
     }