wangzq 2 gadi atpakaļ
vecāks
revīzija
4d4e24b92b

+ 30 - 1
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -513,6 +513,35 @@ class BookController extends BaseController
     {
         // 1:男频,2:女频
         $sex = (int)$request->input('sex');
+        $package     = $request->header('x-package', '');
+        $channel_id = $request->input('distribution_channel_id',0);
+        if (!in_array($sex, [1, 2], true)) {
+            return response()->error('PARAM_ERROR');
+        }
+
+        $bids =  BookConfigService::getAvailableBIdsbyBids( BookConfigService::getRankList($package,$sex),$channel_id,false);
+        if (count($bids) >  30){
+            $bids = array_chunk($bids,30)[0];
+        }else{
+            $bids = [11529, 11941, 12720, 11990, 11988, 11976, 11977, 4183, 12717, 11833,
+                7287,14297,12716,14312,14000,13577,16712,13002,12717,15103,13928,14793,
+                12708,13286];
+            if ($sex === 2) {
+                $bids = [8469, 11660, 9117, 7891, 12281, 12470, 8167, 11661, 11670, 8476, 8557, 11662,
+                    11680, 11926, 12462, 7836, 11681, 11664, 11928, 8631];
+            }
+        }
+
+        $books = collectionTransform(new BookTransformer, BookConfigService::getBookLists(compact('bids','channel_id')));
+
+        return response()->success($books);
+
+    }
+
+    public function rankOld(Request $request)
+    {
+        // 1:男频,2:女频
+        $sex = (int)$request->input('sex');
         if (!in_array($sex, [1, 2], true)) {
             return response()->error('PARAM_ERROR');
         }
@@ -1274,7 +1303,7 @@ class BookController extends BaseController
         $data = BookConfigService::getRecommendBids($package,$channel,[],48);
         $bids = array_chunk($data,12);
         $guss_like = BookConfigService::getRecommendBids($package,$channel,$data,20);
-        // $new_recom = BookConfigService::getNewRecommendBids($package,$channel,$data);
+        $new_recom = BookConfigService::getNewRecommendBids($package,$channel,$data);
         $default = [1,1,1,1,1,1,1,1,1,1,1,1];
         return array_filter([
             ['type' => 'hot', 'lable' => '热门书单', 'books' => collectionTransform(new BookTransformer, BookConfigService::getBooksByIds($bids[0] ?? BookConfigService::getCheckBooks($default,$channel,$package,$is_auth)))],

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 40 - 3
app/Modules/Book/Services/BookConfigService.php