|
@@ -17,9 +17,9 @@ use App\Modules\Book\Models\BookKeyword;
|
|
|
use App\Modules\Book\Models\FreeBook;
|
|
|
use App\Modules\Book\Models\FreeBookConfig;
|
|
|
use App\Modules\Book\Models\QappUserSearchBookLog;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
use phpDocumentor\Reflection\Types\This;
|
|
|
use Redis;
|
|
|
-use DB;
|
|
|
use Vinkla\Hashids\Facades\Hashids;
|
|
|
|
|
|
class BookConfigService
|
|
@@ -335,31 +335,27 @@ class BookConfigService
|
|
|
return array_filter(array_merge($bid_list, $rand_bid));
|
|
|
}
|
|
|
|
|
|
- public static function getRecommendBids($package = '', $channel = 1, $is_auth = true, $no_in_bid = [], $limit = 64)
|
|
|
+ public static function getRecommendBids($package = '', $channel = 1, $no_in_bid = [], $limit = 36,$is_on_shelf = true)
|
|
|
{
|
|
|
+ DB::enableQueryLog();
|
|
|
$where = [
|
|
|
['book_configs.charge_type', '!=', 'BOOK'],
|
|
|
];
|
|
|
- if (!$is_auth) {
|
|
|
- $where[] = ['book_configs.cp_source', '=', 'ycsd'];
|
|
|
- }
|
|
|
-
|
|
|
//获取书籍交集bid,过滤掉不符合要求的书
|
|
|
$bid_list = BookConfig::join('books', 'book_configs.bid', '=', 'books.id')
|
|
|
->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
|
|
|
- ->where('book_configs.is_on_shelf', 2)
|
|
|
+ ->distinct("books.name")
|
|
|
->where($where)
|
|
|
- ->whereNotIn('book_configs.cp_source', getHiddenCp())
|
|
|
+ ->whereNotIn('book_configs.cp_source', getHiddenCp($package))
|
|
|
->where('book_categories.pid', $channel);
|
|
|
+ if ($is_on_shelf){
|
|
|
+ $bid_list->where('book_configs.is_on_shelf', 2);
|
|
|
+ }else{
|
|
|
+ $bid_list->whereIn('book_configs.is_on_shelf', [1,2]);
|
|
|
+ }
|
|
|
if (!empty($no_in_bid)) {
|
|
|
$bid_list->whereNotIn('book_configs.bid', $no_in_bid);
|
|
|
}
|
|
|
-
|
|
|
- $bid_list = $bid_list->orderBy('recommend_index' , 'desc')->limit($limit)->pluck('book_configs.bid');
|
|
|
-
|
|
|
- echo "<pre><hr>";
|
|
|
- var_export($bid_list);
|
|
|
- echo "<hr>";
|
|
|
- die();
|
|
|
+ return $bid_list->orderBy('recommend_index' , 'desc')->orderBy("book_configs.is_high_quality",'desc')->orderBy('books.id' , 'asc')->limit($limit)->pluck('book_configs.bid')->toArray();
|
|
|
}
|
|
|
}
|