Browse Source

从pali_texts 获取书号

visuddhinanda 3 months ago
parent
commit
6b56616dc2
1 changed files with 7 additions and 2 deletions
  1. 7 2
      api-v8/app/Http/Controllers/CategoryController.php

+ 7 - 2
api-v8/app/Http/Controllers/CategoryController.php

@@ -93,7 +93,12 @@ class CategoryController extends Controller
             $chaptersParam[] = [$chapter->book, $chapter->paragraph];
         }
         // 获取该分类下的章节
-        $books = ProgressChapter::with('channel.owner')->whereIns(['book', 'para'], $chaptersParam)
+        $books = ProgressChapter::with('channel.owner')
+            ->leftJoin('pali_texts', function ($join) {
+                $join->on('progress_chapters.book', '=', 'pali_texts.book')
+                    ->on('progress_chapters.para', '=', 'pali_texts.paragraph');
+            })
+            ->whereIns(['progress_chapters.book', 'progress_chapters.para'], $chaptersParam)
             ->whereHas('channel', function ($query) {
                 $query->where('status', 30);
             })
@@ -115,7 +120,7 @@ class CategoryController extends Controller
                 "publisher" => $book->channel->owner,
                 "type" => __('labels.' . $book->channel->type),
                 "category_id" => $id,
-                "cover" => "/assets/images/cover/1/214.jpg",
+                "cover" => "/assets/images/cover/zh-hans/1/{$book->pcd_book_id}.png",
                 "description" => $book->summary ?? "比库戒律的详细说明",
                 "language" => __('language.' . $book->channel->lang),
             ];