wangzq 2 lat temu
rodzic
commit
41b2e0d517
1 zmienionych plików z 26 dodań i 22 usunięć
  1. 26 22
      app/Http/Controllers/QuickApp/Book/BookController.php

+ 26 - 22
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -806,32 +806,36 @@ class BookController extends BaseController
     public function shelfRecom(Request $request)
     {
 
-        $category_id = $request->input('category_id');
-        $bid         = $request->input('bid');
+
         $package     = $request->header('x-package', '');
-        if (empty($package) || $package != 'com.beidao.kuaiying.yueai') {
-            return response()->success([]);
-        }
-        return response()->success([]);
         $user =  (new QappUserService)->getGolableUser();
-        if(isset($user->uid) && !empty($user->uid) && $user->send_order_id  >  0){
-            $bid =  BookConfigService::getAvailableBIdsbyBids([58238,60534,63220,14500,13254,63221,63548,14022,59334,58888,63417,61701],$this->distribution_channel_id,false);
-            if (!empty($bid)){
-                $bid = array_random($bid,4);
-            }
-            $orderRecord = ChapterOrderService::hasUserRecord($user->uid);
-            if($orderRecord && count($bid) >  1){
-                $where = ['is_on_shelf' => [1,2],'bids' => $bid];
-                // $books = BookConfigService::getBooksByIds($bid,[],false);
-                $books = BookConfigService::getBookLists($where,[],false);
-                return response()->collection(new BookTransformer(), $books);
+
+        if (!empty($package) && $package == 'com.beidao.kuaiying.yueai') {
+            if(isset($user->uid) && !empty($user->uid) && $user->send_order_id  >  0){
+                $bid =  BookConfigService::getAvailableBIdsbyBids([58238,60534,63220,14500,13254,63221,63548,14022,59334,58888,63417,61701],$this->distribution_channel_id,false);
+                if (!empty($bid)){
+                    $bid = array_random($bid,4);
+                }
+                $orderRecord = ChapterOrderService::hasUserRecord($user->uid);
+                if($orderRecord && count($bid) >  1){
+                    $where = ['is_on_shelf' => [1,2],'bids' => $bid];
+                    // $books = BookConfigService::getBooksByIds($bid,[],false);
+                    $books = BookConfigService::getBookLists($where,[],false);
+                    return response()->collection(new BookTransformer(), $books);
+                }
             }
+            return response()->success([]);
         }
-        return response()->success([]);
-        $where = ['is_on_shelf' => [2]];
-        $where['channel_id'] = $request->input('distribution_channel_id',0);;
-        $books = BookConfigService::getBooks($where, [], 4);
-        return response()->collection(new BookTransformer(), $books);
+        $where = ['is_on_shelf' => [2],'channel_id' => $this->distribution_channel_id,'is_high_quality' => 1];
+        if (isset($user->uid) && $user->user->sex == 1){
+            $where['channel_name'] = "男频";
+        }else{
+            $where['channel_name'] = "女频";
+        }
+
+        $books = BookConfigService::getBooks($where, [], 3);
+
+        return response()->collection(new BookTransformer(), $commbooks);
     }