add filter years
This commit is contained in:
@@ -32,10 +32,10 @@ function api_login($login, $password){
|
||||
}
|
||||
|
||||
|
||||
function clientbuys_kuri($client_id, $page = 1, $group_id = null){
|
||||
function clientbuys_kuri($client_id, $page = 1, $category_id = 1, $group_id = null, $filter = null){
|
||||
|
||||
if ($group_id == 1 or $group_id == 2){
|
||||
return clients_arch($page);
|
||||
return clients_arch($page, $category_id, $filter);
|
||||
}
|
||||
|
||||
$sql_sub = "SELECT number_id FROM anbuy WHERE client_id = '$client_id' AND `number_id` = 486 AND `buy_status` = '1' LIMIT 1"; //есть ли активная подписка
|
||||
@@ -43,25 +43,46 @@ function clientbuys_kuri($client_id, $page = 1, $group_id = null){
|
||||
|
||||
|
||||
if (isset($findsub['number_id'])) {// есть поп
|
||||
return clients_arch($page);
|
||||
return clients_arch($page, $category_id, $filter);
|
||||
}
|
||||
|
||||
if ($filter !== 'all'){
|
||||
$between = "AND BeginDate BETWEEN '$filter-01-11' AND '$filter-12-31'";
|
||||
}
|
||||
else
|
||||
$between = '';
|
||||
|
||||
$limit = 25;
|
||||
$countsql = "SELECT DISTINCT COUNT(buy_id) as count FROM `anbuy` WHERE `client_id` = $client_id AND `buy_status` = '1' LIMIT 1";
|
||||
$countsql = "
|
||||
SELECT
|
||||
DISTINCT COUNT(buy_id) as count
|
||||
FROM
|
||||
`anbuy`
|
||||
WHERE
|
||||
`client_id` = $client_id
|
||||
AND `buy_status` = '1'
|
||||
$between
|
||||
LIMIT 1
|
||||
";
|
||||
|
||||
$buycount = db_get($countsql);
|
||||
|
||||
|
||||
|
||||
|
||||
$buysql = "
|
||||
SELECT DISTINCT
|
||||
price_id, pricehash, pricename, priceimg
|
||||
FROM anbuy
|
||||
LEFT JOIN price ON anbuy.number_id = price.price_id
|
||||
WHERE client_id = '$client_id' AND `buy_status` = '1'
|
||||
ORDER BY `buy_id` DESC
|
||||
LIMIT $limit";
|
||||
FROM
|
||||
anbuy
|
||||
LEFT JOIN
|
||||
price ON anbuy.number_id = price.price_id
|
||||
WHERE
|
||||
client_id = '$client_id' AND `buy_status` = '1'
|
||||
AND category_id = $category_id
|
||||
$between
|
||||
ORDER BY
|
||||
`buy_id` DESC
|
||||
LIMIT
|
||||
$limit
|
||||
";
|
||||
|
||||
if ($page > 1){
|
||||
$offset = $limit * ($page -1);
|
||||
@@ -203,19 +224,43 @@ function clientmail($mail, $hash){
|
||||
|
||||
|
||||
//весь активный архив
|
||||
function clients_arch($page = 1){
|
||||
function clients_arch($page = 16, $category_id = 1, $filter = 'all'){
|
||||
|
||||
$limit = 25;
|
||||
|
||||
$countsql = "SELECT COUNT(price_id) AS count
|
||||
FROM price
|
||||
WHERE category_id = 1
|
||||
LIMIT 1";
|
||||
|
||||
if ($filter !== 'all'){
|
||||
$between = "AND BeginDate BETWEEN '$filter-01-11' AND '$filter-12-31'";
|
||||
}
|
||||
else
|
||||
$between = '';
|
||||
|
||||
$countsql = "
|
||||
SELECT
|
||||
COUNT(price_id) AS count
|
||||
FROM
|
||||
price
|
||||
WHERE
|
||||
category_id = $category_id
|
||||
$between
|
||||
LIMIT 1
|
||||
";
|
||||
|
||||
$count = db_get($countsql);
|
||||
|
||||
|
||||
$pricesql = "SELECT price_id, pricehash, pricename, priceimg FROM price WHERE category_id = 1 ORDER BY price_id DESC LIMIT $limit";
|
||||
$pricesql = "
|
||||
SELECT
|
||||
price_id, pricehash, pricename, priceimg
|
||||
FROM
|
||||
price
|
||||
WHERE
|
||||
category_id = $category_id
|
||||
$between
|
||||
ORDER BY
|
||||
price_id DESC
|
||||
LIMIT $limit
|
||||
";
|
||||
|
||||
|
||||
if ($page > 1){
|
||||
|
||||
Reference in New Issue
Block a user