Sfoglia il codice sorgente

大拇指和天天好书书籍特殊处理

wangzq 2 anni fa
parent
commit
54e3b5a65d

+ 77 - 0
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -44,6 +44,11 @@ class BookController extends BaseController
             $book_info->is_on_shelf = 2;
             $book_info->is_on_shelf = 2;
         }
         }
 
 
+        $special = get_special_bid();
+        if (in_array($this->distribution_channel_id,[9487,9390]) && in_array($book_info->bid,$special)){
+            $book_info->is_on_shelf = 2;
+        }
+
         if($bid == 58886){
         if($bid == 58886){
             $book_info->is_on_shelf = 0;
             $book_info->is_on_shelf = 0;
         }
         }
@@ -367,6 +372,10 @@ class BookController extends BaseController
 
 
     public function library(Request $request)
     public function library(Request $request)
     {
     {
+        $channel_id = $request->input('distribution_channel_id',0);
+        if (in_array($channel_id,[9487,9390])){
+            return  $this->getSpecialLibrary($request);
+        }
         $where                = [];
         $where                = [];
         $order                = [];
         $order                = [];
         $where['is_on_shelf'] = [2];
         $where['is_on_shelf'] = [2];
@@ -683,5 +692,73 @@ class BookController extends BaseController
         return response()->collection(new BookTransformer(), $books);
         return response()->collection(new BookTransformer(), $books);
     }
     }
 
 
+    private function getSpecialLibrary(Request $request)
+    {
+        $where                = [];
+        $order                = [];
+        $where['is_on_shelf'] = [2,4,7];
+        $category_id          = $request->input('category_id');
+        if ($category_id) {
+            if ($category_id == 1) {
+                $where['channel_name'] = '男频';
+            } elseif ($category_id == 2) {
+                $where['channel_name'] = '女频';
+            } else {
+                $where['category_id'] = $category_id;
+            }
+        }
+        $key = $request->input('key');
+        $uid = $request->input('uid', 0);
+        if ($key && $uid && is_numeric($uid)) {
+            BookConfigService::saveUserSearchLog($key, $uid);
+        }
+        $where['key'] = $key;
+        $order_field  = $request->input('order_field');
+        $order_seq    = $request->input('order_seq');
+        if ($order_field != '' && in_array($order_field, ['recommend_index', 'click_count', 'update', 'size', 'create'])) {
+            if ($order_field == 'update') {
+                $order = ['book_configs.updated_at', 'desc'];
+            } elseif ($order_field == 'create') {
+                $order = ['book_configs.created_at', 'desc'];
+            } else {
+                $order = [$order_field, 'desc'];
+            }
+
+            if ($order_seq == 'asc') {
+                $order = [$order_field, 'asc'];
+            }
+            if ($order_seq == 'desc') {
+                $order = [$order_field, 'desc'];
+            }
+        }
+
+        // 审核状态默认值
+        $package     = $request->header('x-package', '');
+        $brand       = $request->header('x-nbrand', '');
+        $codeVersion = $request->header('x-codeversion', '');
+        if ($order_field === 'recommend_index' && Utils::checkIsAudit($package, $brand, $codeVersion)) {
+            $order = ['book_configs.bid', 'desc'];
+        }
+
+
+        $status = $request->input('status');
+        if ($status != '') {
+            $where['status'] = $status;
+        }
+
+        // 搜索关键词的情况下,屏蔽书籍完本状态
+        if ($key && isset($where['status'])) {
+            unset($where['status']);
+        }
+
+        $page_size = $request->input('page_size', 15);
+        $where['channel_id'] = ($package === 'com.beidao.kuaiying.zsy') ? 7477 : 0;
+        $books     = BookConfigService::getBooks($where, $order, $page_size);
+
+        return response()->pagination(new BookTransformer,$books);
+    }
+
+
+
 
 
 }
 }

+ 5 - 0
app/Http/Controllers/QuickApp/Book/ChapterController.php

@@ -160,6 +160,11 @@ class ChapterController extends BaseController
         if($this->distribution_channel_id == 7477 && $bid == 13765){
         if($this->distribution_channel_id == 7477 && $bid == 13765){
             $book_info->is_on_shelf = 2;
             $book_info->is_on_shelf = 2;
         }
         }
+        $special = get_special_bid();
+        if (in_array($this->distribution_channel_id,[9487,9390]) && in_array($book_info->bid,$special)){
+            $book_info->is_on_shelf = 2;
+        }
+
         if($bid == 58886){
         if($bid == 58886){
             $book_info->is_on_shelf = 0;
             $book_info->is_on_shelf = 0;
         }
         }

+ 7 - 0
app/Libs/Helpers.php

@@ -866,4 +866,11 @@ if (!function_exists("check_qapp_send_order_id)")){
 
 
         return true;
         return true;
     }
     }
+}
+
+if(!function_exists('get_special_bid')){
+    function get_special_bid()
+    {
+        return [10428,8752,10400,7747,7742,7748,8728,8754,8753,8734,8777,7743,8749,8726,8722,8732,8751,7821,8967,8725,8910,9009,8747,4510,8739,4508,8738,8737,8740,8745,13008,8980,7747,8967,7743,7821,8749];
+    }
 }
 }