Prechádzať zdrojové kódy

Merge branch 'kuaiyingyong' of iqiyoo:zhuishuyun_wap into wzq_adth

wangzq 2 rokov pred
rodič
commit
b614ea6dcc

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

@@ -44,6 +44,11 @@ class BookController extends BaseController
             $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){
             $book_info->is_on_shelf = 0;
         }
@@ -367,6 +372,12 @@ class BookController extends BaseController
 
     public function library(Request $request)
     {
+        $package     = $request->header('x-package', '');
+
+
+        if (in_array($package ,["com.app.kyy.dmzyd","com.app.kyy.tths"])){
+            return  $this->getSpecialLibrary($request);
+        }
         $where                = [];
         $order                = [];
         $where['is_on_shelf'] = [2];
@@ -683,5 +694,80 @@ class BookController extends BaseController
         return response()->collection(new BookTransformer(), $books);
     }
 
+    private function getSpecialLibrary(Request $request)
+    {
+        $where                = [];
+        $order                = [];
+        $where['is_on_shelf'] = [2,4];
+        $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);
+        $special = get_special_bid();
+        $list = [];
+        foreach ($books as  $ke => $val){
+           if ($val->is_on_shelf != 2 && !in_array($val->bid,$special)){
+               unset($books[$ke]);
+
+           }
+        }
+        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){
             $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){
             $book_info->is_on_shelf = 0;
         }

+ 3 - 1
app/Http/Middleware/QuickAppGetPackage.php

@@ -19,7 +19,9 @@ class QuickAppGetPackage extends BaseMiddleware
     {
         // 获取头部信息
         $package     = $request->header('x-package', '');
-
+        if(empty($package)){
+            $package = $request->input('package',"");
+        }
         $origin_package = $package;
         //FIXME 海天包传成浩瀚了,特殊处理下,这个名字就给海天用
 //         if($package =='com.beidao.kuaiying.haohan'){

+ 42 - 0
app/Libs/Helpers.php

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