|
|
|
@ -349,22 +349,20 @@ class NetBiblio extends WebService
|
|
|
|
return $this->AddBookData($book);
|
|
|
|
return $this->AddBookData($book);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function GetRandomBooks($number = 100) {
|
|
|
|
public function GetRandomBooks($number = 100, $seed = null) {
|
|
|
|
$sql = "SELECT TOP $number NoticeId
|
|
|
|
if(is_null($seed)) {
|
|
|
|
FROM Notices
|
|
|
|
$seed = time();
|
|
|
|
WHERE
|
|
|
|
}
|
|
|
|
(
|
|
|
|
|
|
|
|
Notices.MediaType1Code='CDD' OR
|
|
|
|
$bs = new BookSearch();
|
|
|
|
Notices.MediaType1Code='CDA' OR
|
|
|
|
$bs->addSortField('random_'.$seed);
|
|
|
|
Notices.MediaType1Code='CDS'
|
|
|
|
$results = $bs->getResults(0, $number);
|
|
|
|
)
|
|
|
|
|
|
|
|
AND Notices.Visible=1
|
|
|
|
if($results['response']['docs']) {
|
|
|
|
AND Notices.[NoticeNr] NOT LIKE '%%~%%'
|
|
|
|
$books = array_map(function($o) { return (array) $o; }, $results['response']['docs']);
|
|
|
|
ORDER BY NEWID();";
|
|
|
|
return $this->AddBookData($books);
|
|
|
|
$ids = Connection::execute($sql)->to_array();
|
|
|
|
}
|
|
|
|
$ids = array_map(function($a) { return $a['NoticeId']; }, $ids);
|
|
|
|
return array();
|
|
|
|
$books = AudioBook::findBy('NoticeId', $ids, true);
|
|
|
|
|
|
|
|
return array_values($this->AddBookData($books));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function Search($query, $start, $limit)
|
|
|
|
public function Search($query, $start, $limit)
|
|
|
|
|