|
@@ -229,6 +229,73 @@ class BookConfig extends Model
|
|
|
return $res->limit(30)->get();
|
|
|
}
|
|
|
|
|
|
+ public static function getBookLists(array $where, array $order = [], $is_external_shelf = true)
|
|
|
+ {
|
|
|
+ if (empty($where)) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ $res = self::join('books', 'book_configs.bid', '=', 'books.id')
|
|
|
+ ->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
|
|
|
+ ->select(
|
|
|
+ 'book_configs.bid',
|
|
|
+ 'book_configs.force_subscribe_chapter_seq',
|
|
|
+ 'book_configs.vip_seq',
|
|
|
+ 'book_configs.price',
|
|
|
+ 'book_configs.is_on_shelf',
|
|
|
+ 'book_configs.cover',
|
|
|
+ 'book_configs.book_name',
|
|
|
+ 'book_configs.copyright',
|
|
|
+ 'book_configs.charge_type',
|
|
|
+ 'book_configs.is_on_shelf',
|
|
|
+ 'books.author',
|
|
|
+ 'books.intro',
|
|
|
+ 'book_categories.category_name',
|
|
|
+ 'category_id',
|
|
|
+ 'status',
|
|
|
+ 'chapter_count',
|
|
|
+ 'book_configs.click_count',
|
|
|
+ 'first_cid',
|
|
|
+ 'last_cid',
|
|
|
+ 'size',
|
|
|
+ 'last_chapter',
|
|
|
+ 'books.keyword',
|
|
|
+ 'book_configs.recommend_index',
|
|
|
+ 'book_configs.is_show_index_content',
|
|
|
+ 'book_configs.product_id',
|
|
|
+ 'book_categories.channel_name',
|
|
|
+ 'books.last_cid',
|
|
|
+ 'books.last_chapter',
|
|
|
+ 'book_configs.product_id',
|
|
|
+ 'books.updated_at as last_update_time',
|
|
|
+ 'book_configs.copyright_limit_data',
|
|
|
+ 'book_configs.promotion_domain',
|
|
|
+ 'books.name as old_name',
|
|
|
+ 'book_configs.recommend_cid'
|
|
|
+ );
|
|
|
+ if(isset($where['bids']) && !empty($where['bids'])){
|
|
|
+ $res->whereIn('book_configs.bid', $where['bids']);
|
|
|
+ }
|
|
|
+
|
|
|
+ if($is_external_shelf) $res->where('is_on_shelf',2);// 默认外部上架
|
|
|
+
|
|
|
+ if ($order) {
|
|
|
+ $res->orderBy($order[0], $order[1]);
|
|
|
+ } else {
|
|
|
+ $str = implode(',', $bid_arr);
|
|
|
+ $field = 'bid,' . $str;
|
|
|
+ $res->orderBy(DB::raw('field(' . $field . ')'));
|
|
|
+ }
|
|
|
+ if(isset($where['channel_id']) && $where['channel_id'] == 7477){
|
|
|
+ $res->whereNotIn('book_configs.cp_source',getHiddenCp());
|
|
|
+ }else{
|
|
|
+ $res->whereNotIn('book_configs.cp_source',array_merge(getHiddenCp(),['lianshang']));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return $res->limit(30)->get();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 根据bid获取图书信息
|