|
@@ -44,6 +44,11 @@ class BookController extends BaseController
|
|
|
$book_info->is_on_shelf = 2;
|
|
|
}
|
|
|
|
|
|
+ $special = get_special_bid();
|
|
|
+ if (in_array($this->distribution_channel_id,[9487,9390]) && in_array($book_info->bid,$special)){
|
|
|
+ $book_info->is_on_shelf = 2;
|
|
|
+ }
|
|
|
+
|
|
|
if($bid == 58886){
|
|
|
$book_info->is_on_shelf = 0;
|
|
|
}
|
|
@@ -367,6 +372,10 @@ class BookController extends BaseController
|
|
|
|
|
|
public function library(Request $request)
|
|
|
{
|
|
|
+ $channel_id = $request->input('distribution_channel_id',0);
|
|
|
+ if (in_array($channel_id,[9487,9390])){
|
|
|
+ return $this->getSpecialLibrary($request);
|
|
|
+ }
|
|
|
$where = [];
|
|
|
$order = [];
|
|
|
$where['is_on_shelf'] = [2];
|
|
@@ -683,5 +692,73 @@ class BookController extends BaseController
|
|
|
return response()->collection(new BookTransformer(), $books);
|
|
|
}
|
|
|
|
|
|
+ private function getSpecialLibrary(Request $request)
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ $order = [];
|
|
|
+ $where['is_on_shelf'] = [2,4,7];
|
|
|
+ $category_id = $request->input('category_id');
|
|
|
+ if ($category_id) {
|
|
|
+ if ($category_id == 1) {
|
|
|
+ $where['channel_name'] = '男频';
|
|
|
+ } elseif ($category_id == 2) {
|
|
|
+ $where['channel_name'] = '女频';
|
|
|
+ } else {
|
|
|
+ $where['category_id'] = $category_id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $key = $request->input('key');
|
|
|
+ $uid = $request->input('uid', 0);
|
|
|
+ if ($key && $uid && is_numeric($uid)) {
|
|
|
+ BookConfigService::saveUserSearchLog($key, $uid);
|
|
|
+ }
|
|
|
+ $where['key'] = $key;
|
|
|
+ $order_field = $request->input('order_field');
|
|
|
+ $order_seq = $request->input('order_seq');
|
|
|
+ if ($order_field != '' && in_array($order_field, ['recommend_index', 'click_count', 'update', 'size', 'create'])) {
|
|
|
+ if ($order_field == 'update') {
|
|
|
+ $order = ['book_configs.updated_at', 'desc'];
|
|
|
+ } elseif ($order_field == 'create') {
|
|
|
+ $order = ['book_configs.created_at', 'desc'];
|
|
|
+ } else {
|
|
|
+ $order = [$order_field, 'desc'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($order_seq == 'asc') {
|
|
|
+ $order = [$order_field, 'asc'];
|
|
|
+ }
|
|
|
+ if ($order_seq == 'desc') {
|
|
|
+ $order = [$order_field, 'desc'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 审核状态默认值
|
|
|
+ $package = $request->header('x-package', '');
|
|
|
+ $brand = $request->header('x-nbrand', '');
|
|
|
+ $codeVersion = $request->header('x-codeversion', '');
|
|
|
+ if ($order_field === 'recommend_index' && Utils::checkIsAudit($package, $brand, $codeVersion)) {
|
|
|
+ $order = ['book_configs.bid', 'desc'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $status = $request->input('status');
|
|
|
+ if ($status != '') {
|
|
|
+ $where['status'] = $status;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 搜索关键词的情况下,屏蔽书籍完本状态
|
|
|
+ if ($key && isset($where['status'])) {
|
|
|
+ unset($where['status']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $page_size = $request->input('page_size', 15);
|
|
|
+ $where['channel_id'] = ($package === 'com.beidao.kuaiying.zsy') ? 7477 : 0;
|
|
|
+ $books = BookConfigService::getBooks($where, $order, $page_size);
|
|
|
+
|
|
|
+ return response()->pagination(new BookTransformer,$books);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|