|
@@ -4,6 +4,7 @@
|
|
namespace App\Modules\Channel\Services;
|
|
namespace App\Modules\Channel\Services;
|
|
|
|
|
|
|
|
|
|
|
|
+use App\Modules\Book\Services\BookConfigService;
|
|
use App\Modules\Channel\Models\ChannelRecommendBooks;
|
|
use App\Modules\Channel\Models\ChannelRecommendBooks;
|
|
|
|
|
|
class ChannelRecommendBooksService
|
|
class ChannelRecommendBooksService
|
|
@@ -57,17 +58,20 @@ class ChannelRecommendBooksService
|
|
static function getRecommendBooks($channel_id,$bid = 0)
|
|
static function getRecommendBooks($channel_id,$bid = 0)
|
|
{
|
|
{
|
|
$bids = self::getMergerBids($channel_id,$bid);
|
|
$bids = self::getMergerBids($channel_id,$bid);
|
|
- if(!isset($channel_id)) return [];
|
|
|
|
- $query = ChannelRecommendBooks::leftjoin('book_configs','book_configs.bid','channel_recommend_books.bid')
|
|
|
|
- ->leftjoin('books','books.id','channel_recommend_books.bid')
|
|
|
|
- ->select('books.intro','books.category_name','book_configs.book_name','book_configs.cover','book_configs.bid','channel_recommend_books.priority')
|
|
|
|
- ->orderBy('channel_recommend_books.priority','DESC')->orderBy('channel_recommend_books.created_at','DESC');
|
|
|
|
-
|
|
|
|
- $query->where('channel_recommend_books.channel_id',$channel_id)
|
|
|
|
- ->whereIn('channel_recommend_books.bid',$bids);
|
|
|
|
|
|
|
|
|
|
+ if(!isset($channel_id)) return [];
|
|
|
|
|
|
- return $query->get()->toArray();
|
|
|
|
|
|
+ return BookConfigService::getBooksByIds($bids,[],false);
|
|
|
|
+// $query = ChannelRecommendBooks::leftjoin('book_configs','book_configs.bid','channel_recommend_books.bid')
|
|
|
|
+// ->leftjoin('books','books.id','channel_recommend_books.bid')
|
|
|
|
+// ->select('books.intro','books.category_name','book_configs.book_name','book_configs.cover','book_configs.bid','channel_recommend_books.priority')
|
|
|
|
+// ->orderBy('channel_recommend_books.priority','DESC')->orderBy('channel_recommend_books.created_at','DESC');
|
|
|
|
+//
|
|
|
|
+// $query->where('channel_recommend_books.channel_id',$channel_id)
|
|
|
|
+// ->whereIn('channel_recommend_books.bid',$bids);
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// return $query->get()->toArray();
|
|
}
|
|
}
|
|
|
|
|
|
static function incrRecommendNum($channel_id,$bids)
|
|
static function incrRecommendNum($channel_id,$bids)
|