new function to get Random Books
This commit is contained in:
@@ -262,6 +262,14 @@ class NetBiblio extends WebService
|
|||||||
return $this->AddFiles($book);
|
return $this->AddFiles($book);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetRandomBooks($number = 100) {
|
||||||
|
$sql = "SELECT TOP $number NoticeId FROM Notices ORDER BY NEWID();";
|
||||||
|
$ids = Connection::execute($sql)->to_array();
|
||||||
|
$ids = array_map(function($a) { return $a['NoticeId']; }, $ids);
|
||||||
|
$books = AudioBook::findBy('NoticeId', $ids, true);
|
||||||
|
return array_values(array_map(array($this, 'AddFiles'), $books));
|
||||||
|
}
|
||||||
|
|
||||||
public function Search($query, $start, $limit)
|
public function Search($query, $start, $limit)
|
||||||
{
|
{
|
||||||
$query = array(
|
$query = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user