Browse Source

阅爱小说男频派单用户书籍走固定配置

wangzq 2 năm trước cách đây
mục cha
commit
6761c373e8

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

@@ -9,7 +9,7 @@ use App\Modules\RecommendBook\Services\RecommendService;
 use App\Modules\Book\Services\RecoBannerService;
 use App\Modules\User\Models\QappPackage;
 use App\Modules\User\Services\QappUserService;
-use Hashids\Hashids;
+
 use Illuminate\Http\Request;
 use App\Http\Controllers\QuickApp\BaseController;
 use App\Http\Controllers\QuickApp\Book\Transformers\BookTransformer;
@@ -24,6 +24,7 @@ use App\Modules\Subscribe\Services\BookOrderService;
 use App\Modules\Subscribe\Services\ChapterOrderService;
 use App\Modules\Subscribe\Services\YearOrderService;
 use App\Modules\User\Services\ReadRecordService;
+use Vinkla\Hashids\Facades\Hashids;
 
 class BookController extends BaseController
 {
@@ -171,12 +172,16 @@ class BookController extends BaseController
         $brand       = $request->header('x-nbrand', '');
         $codeVersion = $request->header('x-codeversion', '');
         $isAuth = check_qapp_auth($package ,0);
+        $send_order_id = $request->header('send-order-id', 0);
         // 根据包名、平台、版本号判断是否审核
         if (Utils::checkIsAudit($package, $brand, $codeVersion) || $isAuth == false) {
             $result = BookAuditService::getHomeBooksData($sex, $package,$isAuth);
             return response()->success($result);
         }
-
+        if($send_order_id >  0 && $package == "com.beidao.kuaiying.yueai" && $sex == "male"){
+            $result  = BookAuditService::getYueaiHomeBooksData($sex, $package,$isAuth);
+            return  response()->success($result);
+        }
         if ($sex == 'male') {
             $channel          = 1;
             $reco_banner_type = ['MALE', 'PUBLIC'];

+ 46 - 0
app/Modules/Book/Services/BookAuditService.php

@@ -67,4 +67,50 @@ class BookAuditService
             ],
         ];
     }
+
+    public static function getYueaiHomeBooksData($sex, $package,$is_auth): array
+    {
+        $home = config('home.yueai');
+        if (!$is_auth){
+            $home = config('home.ycsd');
+        }
+        $banner      = $home['reco_banner'];
+        $bannerBooks = $banner[$sex];
+
+        // 模块
+        [$hot, $live, $recom, $new] = [$home['hot'], $home['zhibo'], $home['recom'], $home['new_recom']];
+        [$hotBids, $liveBids, $recomBids, $newBids] = [$hot[$sex], $live[$sex], $recom[$sex], $new[$sex]];
+
+        // 一次性获取书籍列表
+        $bids  = array_merge($hotBids, $liveBids, $recomBids, $newBids);
+        $channel_id = ($package === 'com.beidao.kuaiying.zsy') ? 7477 : 0;
+        $books = BookConfigService::getBookLists(compact('bids','channel_id'),[],false);
+        return [
+            [
+                'type'  => 'reco_banner',
+                'lable' => $banner['label'],
+                'books' => $bannerBooks
+            ],
+            [
+                'type'  => 'hot',
+                'lable' => $hot['label'],
+                'books' => collectionTransform(new BookTransformer, collect($books)->whereIn('bid', $hotBids)->all())
+            ],
+            [
+                'type'  => 'zhibo',
+                'lable' => $live['label'],
+                'books' => collectionTransform(new BookTransformer, collect($books)->whereIn('bid', $liveBids)->all())
+            ],
+            [
+                'type'  => 'recom',
+                'lable' => $recom['label'],
+                'books' => collectionTransform(new BookTransformer, collect($books)->whereIn('bid', $recomBids)->all())
+            ],
+            [
+                'type'  => 'new_recom',
+                'lable' => $new['label'],
+                'books' => collectionTransform(new BookTransformer, collect($books)->whereIn('bid', $newBids)->all())
+            ],
+        ];
+    }
 }

+ 56 - 1
config/home.php

@@ -127,6 +127,61 @@ return [
         'male'   => [86,2942,2943,2773,2900,2921,2929,2935,2940,2944,2903,2928,2945,2948,17,85,94,141,574,1190,1780,2885,2887,2915,2920,2923,2926,2927,2937,2939,2941,2947,2993],
         'female' => [14163,17055,3697,59004,15720,13082,58950,60902,61012,7567,11671,15537,16133,16184,16220,22393,22394,22395,58329,58801,58864,59020,59295,59293,60238,60736,61425,59297,59579,59813],
     ],
-
+    'yueai'     => [
+        'reco_banner' => [
+            'label'  => '首页banner',
+            'male'   => [
+                [
+                    'redirect_url' => 'views/Detail',
+                    'banner_url'   => 'https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/app/banner/202208121702.jpeg',
+                    'bid'          => 'XD3QMAwoPJaj4RjVXrRke0BmNn6p15LZ', // 62297 美女总裁的上门医生
+                    'cid'          => 0
+                ],[
+                    'redirect_url' => 'views/Detail',
+                    'banner_url'   => 'https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/app/banner/202208121709.jpeg',
+                    'bid'          => 'qvQ0OXLZE2ba3KnpDZgoDNzyJxMBrAVw', // 63074 狂医神婿
+                    'cid'          => 0
+                ],
+                [
+                    'redirect_url' => 'views/Detail',
+                    'banner_url'   => 'https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/app/banner/202208121707.jpeg',
+                    'bid'          => 'Vj0d9pDXbAan5Kb0NygqY7BzweEP1vmM', // 60026 夫人攻略
+                    'cid'          => 0
+                ],
+            ],
+            'female' => [
+                [
+                    'redirect_url' => 'views/Detail',
+                    'banner_url'   => 'https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/book/cover/082576b8d38afc0b8c890c8d6e5dfc93.jpeg',
+                    'bid'          => '2VkOMpjBem8ZNgrxqQKY7d9r5LE03Dwz', // 15720 黑夜见过他深情
+                    'cid'          => 0
+                ],
+            ],
+        ],
+        'hot'         => [
+            'label'  => '热门书单',
+            'male'   => [63225,63183,14016,14927,58994,63226],
+            'female' => [14620,58195,11680,59296,13082,11681],
+        ],
+        'zhibo'       => [
+            'label'  => '神书直播',
+            'male'   => [63199,13300,58960,58890,9745,59784],
+            'female' => [58950,12331,59297,17055,15720,15537],
+        ],
+        'recom'       => [
+            'label'  => '小编精选',
+            'male'   => [61596,61736,15103,14351,58892,61526],
+            'female' => [11883,22394,12901,60902,11671,4112],
+        ],
+        'new_recom'   => [
+            'label'  => '人气新书',
+            'male'   => [63180,58896,13928,58894,14408,13931],
+            'female' => [10846,60736,61425,10074,15216,60734],
+        ],
+    ],
+    'rank' =>[
+        'male'   => [86,2942,2943,2773,2900,2921,2929,2935,2940,2944,2903,2928,2945,2948,17,85,94,141,574,1190,1780,2885,2887,2915,2920,2923,2926,2927,2937,2939,2941,2947,2993],
+        'female' => [14163,17055,3697,59004,15720,13082,58950,60902,61012,7567,11671,15537,16133,16184,16220,22393,22394,22395,58329,58801,58864,59020,59295,59293,60238,60736,61425,59297,59579,59813],
+    ],
 
 ];