2021-01-13 21:09:17 +03:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function bookid_kuri($hash) {
|
|
|
|
|
|
2021-05-16 14:15:10 +03:00
|
|
|
$query = "SELECT `price_id`, `pricename`, `BeginDate`, `priceanons`, `priceimg`, `pricehash`, `price` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1";
|
2021-01-13 21:09:17 +03:00
|
|
|
|
|
|
|
|
$book = dbl_get($query);
|
|
|
|
|
|
|
|
|
|
if (isset($book['price_id'])){
|
|
|
|
|
|
|
|
|
|
$book['pic'] = IMGSRV."price/180x280/{$book['price_id']}.{$book['priceimg']}";
|
|
|
|
|
$book['links']['pdf'] = SITE.'read/'.$book['pricehash'];
|
|
|
|
|
$book['links']['text'] = SITE.'readtext/'.$book['pricehash'];
|
|
|
|
|
$book['links']['download'] = SITE.'pub/files/pdf/'.$book['pricehash'].'.pdf';
|
|
|
|
|
|
|
|
|
|
return $book;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-05-16 14:15:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* вернуть товары магазина (все или по фильтру)
|
|
|
|
|
*/
|
|
|
|
|
function api_books_kuri($category = 'all', $page = 1){
|
|
|
|
|
|
|
|
|
|
$limit = 25;
|
|
|
|
|
|
|
|
|
|
if ($page > 1){
|
|
|
|
|
$offset = $limit * ($page - 1);
|
|
|
|
|
$offset_str = ", $offset";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$offset_str = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($category == 'all'){
|
|
|
|
|
$where = '';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
$category_sql = "SELECT `category_id` FROM `pricecategory` WHERE `categoryslug` = '$category' LIMIT 1";
|
|
|
|
|
|
|
|
|
|
$category = db_get($category_sql);
|
|
|
|
|
|
|
|
|
|
if (isset($category['category_id'])) {
|
|
|
|
|
$category_id = $category['category_id'];
|
|
|
|
|
$where = "WHERE `category_id` = $category_id";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sql_books = "SELECT * FROM `price` $where ORDER BY `price_id` DESC LIMIT $limit $offset_str";
|
|
|
|
|
|
|
|
|
|
return db_get($sql_books);
|
2021-01-13 21:09:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|