|
@@ -263,10 +263,10 @@ class BookController extends BaseController
|
|
|
private function getCheckBids($channel,$books,$package_id,$package)
|
|
|
{
|
|
|
$isAuthor = check_qapp_auth($package_id,1);
|
|
|
- $hotBids = $this->getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'hot',$package_id),$channel,$package,$isAuthor);
|
|
|
- $liveBids = $this->getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'live',$package_id),$channel,$package,$isAuthor);
|
|
|
- $recomBids = $this->getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'recom',$package_id),$channel,$package,$isAuthor);
|
|
|
- $newBids = $this->getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'new_recom',$package_id),$channel,$package,$isAuthor);
|
|
|
+ $hotBids = BookConfigService::getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'hot',$package_id),$channel,$package,$isAuthor);
|
|
|
+ $liveBids = BookConfigService::getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'live',$package_id),$channel,$package,$isAuthor);
|
|
|
+ $recomBids = BookConfigService::getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'recom',$package_id),$channel,$package,$isAuthor);
|
|
|
+ $newBids = BookConfigService::getCheckBooks(QappRecommendService::getRecommendByPacketId($channel, 'new_recom',$package_id),$channel,$package,$isAuthor);
|
|
|
|
|
|
|
|
|
return array_filter([
|
|
@@ -305,27 +305,26 @@ class BookController extends BaseController
|
|
|
['book_configs.charge_type','!=','BOOK'],
|
|
|
];
|
|
|
}
|
|
|
- // //获取当前有效书本数量
|
|
|
- // $book_count = BookConfig::join('books', 'book_configs.bid', '=', 'books.id')
|
|
|
- // ->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
|
|
|
- // ->whereIn('book_configs.bid',$bid_list)
|
|
|
- // ->where('book_configs.is_on_shelf',2)
|
|
|
- // ->where('book_configs.charge_type','!=','BOOK')
|
|
|
- // ->whereNotIn('book_configs.cp_source',$hidden_cp)
|
|
|
- // ->where($where)
|
|
|
- //
|
|
|
- // ->where('book_categories.pid',$channel)
|
|
|
- // ->count();
|
|
|
-
|
|
|
- //
|
|
|
- // if($count == $book_count){
|
|
|
- // return $bid_list;
|
|
|
- // }
|
|
|
+ //获取当前有效书本数量
|
|
|
+ $book_count = BookConfig::join('books', 'book_configs.bid', '=', 'books.id')
|
|
|
+ ->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
|
|
|
+ ->whereIn('book_configs.bid',$bid_list)
|
|
|
+ ->where('book_configs.is_on_shelf',2)
|
|
|
+ ->where('book_configs.charge_type','!=','BOOK')
|
|
|
+ ->whereNotIn('book_configs.cp_source',$hidden_cp)
|
|
|
+ ->where($where)
|
|
|
+
|
|
|
+ ->where('book_categories.pid',$channel)
|
|
|
+ ->count();
|
|
|
+
|
|
|
+ if($count == $book_count){
|
|
|
+ return $bid_list;
|
|
|
+ }
|
|
|
//获取需要补充的书籍数量
|
|
|
- // $supplement_count = (($count - $book_count) > 0) ? $count - $book_count : 0;
|
|
|
- // if($supplement_count <= 0){
|
|
|
- // return $bid_list;
|
|
|
- // }
|
|
|
+ $supplement_count = (($count - $book_count) > 0) ? $count - $book_count : 0;
|
|
|
+ if($supplement_count <= 0){
|
|
|
+ return $bid_list;
|
|
|
+ }
|
|
|
//获取书籍交集bid,过滤掉不符合要求的书
|
|
|
$bids = BookConfig::join('books', 'book_configs.bid', '=', 'books.id')
|
|
|
->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
|
|
@@ -335,14 +334,8 @@ class BookController extends BaseController
|
|
|
->whereNotIn('book_configs.cp_source',$hidden_cp)
|
|
|
->where('book_categories.pid',$channel)
|
|
|
->pluck('book_configs.bid')->all();
|
|
|
- // $bid_list = array_intersect($bid_list,$bids);
|
|
|
- $book_count = count($bids);
|
|
|
- if ($book_count === $count){
|
|
|
- return $bid_list;
|
|
|
- }
|
|
|
- $log = ['bid_list',$bid_list,'bids' => $bids];
|
|
|
- $bid_list = $bids;
|
|
|
- $supplement_count = $count - $book_count;
|
|
|
+ $bid_list = array_intersect($bid_list,$bids);
|
|
|
+
|
|
|
//获取随机的有效的书籍bid
|
|
|
$rand_bid = BookConfig::join('books', 'book_configs.bid', '=', 'books.id')
|
|
|
->leftjoin('book_categories', 'books.category_id', 'book_categories.id')
|
|
@@ -355,8 +348,7 @@ class BookController extends BaseController
|
|
|
->inRandomOrder()
|
|
|
->limit($supplement_count)
|
|
|
->get()->pluck('bid')->toArray();
|
|
|
- $log['result'] = array_merge($bid_list,$rand_bid);
|
|
|
- myLog('Qapp_index_bid')->info($log);
|
|
|
+
|
|
|
return array_filter(array_merge($bid_list,$rand_bid));
|
|
|
}
|
|
|
|