fix LastBooksByType and GetRandomBooks
This commit is contained in:
@@ -317,7 +317,7 @@ class NetBiblio extends WebService
|
|||||||
|
|
||||||
// add fields for mobile apps compatibility
|
// add fields for mobile apps compatibility
|
||||||
$b['date'] = date('Y.m.d', strtotime($b['availabilityDate']));
|
$b['date'] = date('Y.m.d', strtotime($b['availabilityDate']));
|
||||||
$b['readBy'] = $b['reader'];
|
$b['readBy'] = isset($b['reader']) ? $b['reader'] : null;
|
||||||
$b['code3'] = $b['producerCode'];
|
$b['code3'] = $b['producerCode'];
|
||||||
$b['code3Long'] = $b['producer'];
|
$b['code3Long'] = $b['producer'];
|
||||||
$b['typeMedia1'] = $b['mediaType'];
|
$b['typeMedia1'] = $b['mediaType'];
|
||||||
@@ -394,7 +394,8 @@ class NetBiblio extends WebService
|
|||||||
|
|
||||||
$bs = new BookSearch();
|
$bs = new BookSearch();
|
||||||
$bs->addSortField('random_'.$seed);
|
$bs->addSortField('random_'.$seed);
|
||||||
return $this->AddBookData($bs->getResults(0, $number));
|
$results = $bs->getResults(0, $number);
|
||||||
|
return $this->AddBookData($results['books']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Search($query, $start, $limit)
|
public function Search($query, $start, $limit)
|
||||||
@@ -525,19 +526,12 @@ class NetBiblio extends WebService
|
|||||||
}
|
}
|
||||||
$s->addSortField('availabilityDate');
|
$s->addSortField('availabilityDate');
|
||||||
|
|
||||||
try {
|
$results = $s->getResults(0, $itemsByGroup);
|
||||||
$results = $s->getResults(0, $itemsByGroup);
|
$books = $this->AddBookData($results['books']);
|
||||||
} catch(\SolrClientException $e) {
|
|
||||||
throw new WebException ("SolrError", $e->getMessage(), -710);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ids = array_map(function($r) { return $r['id']; }, $results['response']['docs']);
|
|
||||||
$books = AudioBook::findBy('NoticeID', $ids, true);
|
|
||||||
$books = $this->AddBookData($books);
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach($books as $b) {
|
foreach($books as $b) {
|
||||||
$data[$b['type']][] = $b;
|
$data[$b['genre']][] = $b;
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user