1
This commit is contained in:
parent
83954fa7f2
commit
3f42f39352
@ -16,6 +16,7 @@ class Mall(object):
|
|||||||
['page', 0, '第几页数据'],
|
['page', 0, '第几页数据'],
|
||||||
['seller', '', '查询指定钱包 为空的化查询所有人'],
|
['seller', '', '查询指定钱包 为空的化查询所有人'],
|
||||||
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
||||||
|
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
||||||
['price_filter', '', '价格过滤(用|分割)'],
|
['price_filter', '', '价格过滤(用|分割)'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
|
2
third_party/phpcommon
vendored
2
third_party/phpcommon
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 7b9d24921cb7a2d2cd6d793604b8d69f3d2786b3
|
Subproject commit 9f75ccab850c1681c405a496c57acf4b0cca4343
|
@ -29,6 +29,24 @@ class MallController extends BaseAuthedController {
|
|||||||
if (!empty($seller)) {
|
if (!empty($seller)) {
|
||||||
$queryData['seller'] = $seller;
|
$queryData['seller'] = $seller;
|
||||||
}
|
}
|
||||||
|
$queryData['price_filter'] = getReqVal('price_filter', '');
|
||||||
|
$orderBy = '';
|
||||||
|
$orderAsc = 'ASC';
|
||||||
|
if (getReqVal('order_asc', '') == 1) {
|
||||||
|
$orderAsc = 'DESC';
|
||||||
|
}
|
||||||
|
switch (getReqVal('order_method', '')) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
$orderBy = 'ORDER BY createtime ' . $orderAsc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
$orderBy = 'ORDER BY price ' . $orderAsc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$out = array(
|
$out = array(
|
||||||
'pagination' => array(),
|
'pagination' => array(),
|
||||||
@ -52,9 +70,23 @@ class MallController extends BaseAuthedController {
|
|||||||
'cond' => '=',
|
'cond' => '=',
|
||||||
'ignore_empty' => true,
|
'ignore_empty' => true,
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'price_filter',
|
||||||
|
'field_name' => '',
|
||||||
|
'cond' => 'custom',
|
||||||
|
'ignore_empty' => true,
|
||||||
|
'custom_func' => function () use ($queryData) {
|
||||||
|
$priceFilters = $queryData['price_filter'];
|
||||||
|
error_log($priceFilters);
|
||||||
|
$arrPriceFilter = explode('|', $priceFilters);
|
||||||
|
$priceLow = $arrPriceFilter[0];
|
||||||
|
$priceHigh = $arrPriceFilter[1];
|
||||||
|
return "AND (price >= ${priceLow} AND price <= ${priceHigh})";
|
||||||
|
}
|
||||||
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
//'orderBy' => $orderBy,
|
'orderBy' => $orderBy,
|
||||||
'handle' => function ($row) use(&$out) {
|
'handle' => function ($row) use(&$out) {
|
||||||
array_push($out['rows'], Mall::toDto($row));
|
array_push($out['rows'], Mall::toDto($row));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user