lh 4 天之前
父节点
当前提交
e434eee612
共有 2 个文件被更改,包括 8 次插入6 次删除
  1. 2 2
      app/Services/Book/BookService.php
  2. 6 4
      app/Services/Timbre/TimbreService.php

+ 2 - 2
app/Services/Book/BookService.php

@@ -55,7 +55,7 @@ class BookService
 
         $query = DB::table('books as b')->leftJoin('book_configs as bc', 'b.id', '=', 'bc.bid')
         ->where('b.size', '<', 30000)->where('b.status', 1)
-        ->whereIn('bc.cp_source', ['ycsd', 'yqsd'])->select('bid', 'book_name');
+        ->whereIn('bc.cp_source', ['ycsd', 'yqsd'])->select('bc.bid', 'bc.book_name');
         if ($bid) {
             $query->where('bc.bid', $bid);
         }
@@ -180,7 +180,7 @@ class BookService
         if (!$bid) Utils::throwError('20003:请选择书籍');
         if (!$version_id) Utils::throwError('20003:请选择版本');
         $generate_status = getProp($data, 'generate_status');
-        $book = DB::table('books as b')->leftJoin('book_configs as bc', 'b.id', '=', 'bc.bid')->where('b.id', $bid)->whereIn('bc.is_on_shelf', [1,2])
+        $book = DB::table('books as b')->leftJoin('book_configs as bc', 'b.id', '=', 'bc.bid')->where('b.id', $bid)
         ->select('bc.book_name', 'bc.cover', 'b.size', 'b.chapter_count', 'b.intro')->first();
         if (!$book) Utils::throwError('20003:书籍不存在');
         $header = (array)$book;

+ 6 - 4
app/Services/Timbre/TimbreService.php

@@ -171,16 +171,18 @@ class TimbreService
         $bid = getProp($data, 'bid');
         $book_name = getProp($data, 'book_name');
 
-        $query = DB::table('book_configs')->whereIn('is_on_shelf', [1,2])->select('bid', 'book_name');
+        $query = $query = DB::table('books as b')->leftJoin('book_configs as bc', 'b.id', '=', 'bc.bid')
+        ->where('b.size', '<', 30000)->where('b.status', 1)
+        ->whereIn('bc.cp_source', ['ycsd', 'yqsd'])->select('bc.bid', 'bc.book_name');
         if ($bid) {
-            $query->where('bid', $bid);
+            $query->where('bc.bid', $bid);
         }
 
         if ($book_name) {
-            $query->where('book_name', 'like', "%{$book_name}%");
+            $query->where('bc.book_name', 'like', "%{$book_name}%");
         }
 
-        return $query->orderBy('bid', 'desc')->get()->map(function($value) {
+        return $query->orderBy('bc.bid', 'desc')->get()->map(function($value) {
             return (array)$value;
         })->toArray();
     }