|
@@ -29,7 +29,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'])->whereIn('bc.is_on_shelf', [1,2])->select('b.status', 'bc.*',
|
|
|
+ ->whereIn('bc.cp_source', ['ycsd', 'yqsd'])->select('b.status', 'bc.*',
|
|
|
DB::raw('(select count(id) from mp_book_version where bid = b.id) as version_count'));
|
|
|
|
|
|
if ($bid) {
|
|
@@ -53,16 +53,18 @@ class BookService
|
|
|
$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 = 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');
|
|
|
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();
|
|
|
}
|