Procházet zdrojové kódy

Merge branch 'kuaiyingyong' into kuaiyingyong_wcc

Wang Chen před 4 roky
rodič
revize
82aacbfbdc

+ 1 - 1
app/Http/Controllers/QuickApp/User/ReadRecordController.php

@@ -72,7 +72,7 @@ class ReadRecordController extends BaseController
                 $id_arr[] = $value['bid'];
             }
 
-            $book = BookConfigService::getBooksByIds($id_arr);
+            $book = BookConfigService::getBooksByIds($id_arr,[],false);//下架图书最近阅读可看到
             foreach ($res as $key => &$value) {
                 $value['cover'] = '';
                 $value['last_chapter'] = 0;

+ 5 - 3
app/Modules/Book/Models/BookConfig.php

@@ -315,7 +315,7 @@ class BookConfig extends Model
      * @param array $order
      * @return mixed
      */
-    public static function getBooksByIds(array $bid_arr, array $order = [])
+    public static function getBooksByIds(array $bid_arr, array $order = [], $is_external_shelf = true)
     {
         $res = self::join('books', 'book_configs.bid', '=', 'books.id')
             ->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
@@ -355,8 +355,10 @@ class BookConfig extends Model
                 'books.name as old_name',
                 'book_configs.recommend_cid'
             )
-            ->whereIn('book_configs.bid', $bid_arr)
-            ->where('is_on_shelf', 2);
+            ->whereIn('book_configs.bid', $bid_arr);
+
+        if($is_external_shelf) $res->where('is_on_shelf',2);// 默认外部上架
+
         if ($order) {
             $res->orderBy($order[0], $order[1]);
         } else {

+ 3 - 3
app/Modules/Book/Services/BookConfigService.php

@@ -42,15 +42,15 @@ class BookConfigService
      * @param null $order
      * @return mixed
      */
-    public static function getBooksByIds(array $where, $order = [])
+    public static function getBooksByIds(array $where, $order = [],$is_external_shelf=true)
     {
         if (empty($where)) {
             return (object)array();
         }
         if ($order)
-            $res = BookConfig::getBooksByIds($where, $order);
+            $res = BookConfig::getBooksByIds($where,$order,$is_external_shelf);
         else
-            $res = BookConfig::getBooksByIds($where);
+            $res = BookConfig::getBooksByIds($where,[],$is_external_shelf);
         return $res;
     }