=',1], ['book_configs.is_on_shelf','<=',2] ]; if($pid){ $filter[] = ['superior_history_book.pid','=',$pid]; } if($search){ $filter = array_merge($filter,$search); } $res = self::where($filter) ->select(['superior_history_book.id','superior_history_book.bid','superior_history_book.register_uv_rate','superior_history_book.pay_uv_rate','superior_history_book.charge_uv_rate','book_configs.book_name','superior_history_book.pid','superior_history_book.created_at','superior_history_book.order_index']) ->leftjoin('book_configs','book_configs.bid','=','superior_history_book.bid') ->orderBy('superior_history_book.order_index','asc') ->orderBy('superior_history_book.recommend_index','desc') ->orderBy('superior_history_book.id','asc'); if($paginate){ $res = $res->paginate($page_size); }else{ $res = $res->get(); } return $res; } }