Jelajahi Sumber

'补充过滤条件'

zhuchengjie 3 tahun lalu
induk
melakukan
536c9290f2
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      app/Http/Controllers/QuickApp/Book/BookController.php

+ 4 - 2
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -273,7 +273,9 @@ class BookController extends BaseController
         }
         //获取需要补充的书籍数量
         $supplement_count = (($count - $book_count) > 0) ? $count - $book_count : 0;
-
+        if($supplement_count <= 0){
+            return $bid_list;
+        }
         //获取随机的有效的书籍bid
         $rand_bid = BookConfig::join('books', 'book_configs.bid', '=', 'books.id')
             ->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
@@ -284,7 +286,7 @@ class BookController extends BaseController
             ->where('book_categories.pid',$channel)
             ->get()->pluck('book_configs.bid')->toArray();
 
-        return array_merge($bid_list,$rand_bid);
+        return array_fill(array_merge($bid_list,$rand_bid));
     }
 
     private function getBidCidFromUrl(string $url)