This commit is contained in:
hujiabin 2024-05-20 15:58:29 +08:00
parent b0beee5924
commit f9db523c2d
2 changed files with 94 additions and 16 deletions

View File

@ -90,10 +90,14 @@ class InGameMall(object):
'url': 'webapp/index.php?c=InGameMall&a=sellList', 'url': 'webapp/index.php?c=InGameMall&a=sellList',
'params':[ 'params':[
_common.ReqHead(), _common.ReqHead(),
['page', 0, '第几页数据'],
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:购买时间 2:价格'],
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
], ],
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),
['!list', [_common.InGameMallGoods()], '商品列表'] ['pagination', _common.Pagination(), '分页信息'],
['!rows', [_common.InGameMallGoods()], '商品列表']
] ]
}, },
{ {
@ -103,10 +107,14 @@ class InGameMall(object):
'url': 'webapp/index.php?c=InGameMall&a=buyList', 'url': 'webapp/index.php?c=InGameMall&a=buyList',
'params':[ 'params':[
_common.ReqHead(), _common.ReqHead(),
['page', 0, '第几页数据'],
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:购买时间 2:价格'],
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
], ],
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),
['!list', [_common.InGameMallGoods()], '商品列表'] ['pagination', _common.Pagination(), '分页信息'],
['!rows', [_common.InGameMallGoods()], '商品列表']
] ]
}, },
{ {

View File

@ -477,23 +477,93 @@ class InGameMallController extends BaseAuthedController {
} }
public function sellList(){ public function sellList(){
$list = array(); $page = getReqVal('page', 0);
InGameMall::getMySell(function ($row) use (&$list) { $orderBy = '';
array_push($list,$row); $orderAsc = 'ASC';
}); if (getReqVal('order_asc', '') == 1) {
$this->_rspData(array( $orderAsc = 'DESC';
'list' => $list }
)); switch (getReqVal('order_method', '')) {
case 1:
{
$orderBy = 'ORDER BY buy_ok_time ' . $orderAsc;
}
break;
case 2:
{
$orderBy = 'ORDER BY length(price) ' . $orderAsc . ', price ' . $orderAsc;
}
break;
}
$out = array(
'pagination' => array(),
'rows' => array()
);
SqlHelper::rawQueryPage(
myself()->_getMySql(''),
'SELECT * FROM t_ingame_mall WHERE seller=:seller AND status=:status',
array(
':seller' => myself()->_getAccountId(),
':status' => Mall::BUY_OK_STATE,
),
array(
'page' => $page,
'perPage' => 10,
'orderBy' => $orderBy,
'handle' => function ($row) use(&$out) {
array_push($out['rows'], $row);
}
),
$out['pagination']
);
myself()->_rspData($out);
} }
public function buyList(){ public function buyList(){
$list = array(); $page = getReqVal('page', 0);
InGameMall::getMyBuy(function ($row) use (&$list) { $orderBy = '';
array_push($list,$row); $orderAsc = 'ASC';
}); if (getReqVal('order_asc', '') == 1) {
$this->_rspData(array( $orderAsc = 'DESC';
'list' => $list }
)); switch (getReqVal('order_method', '')) {
case 1:
{
$orderBy = 'ORDER BY buy_ok_time ' . $orderAsc;
}
break;
case 2:
{
$orderBy = 'ORDER BY length(price) ' . $orderAsc . ', price ' . $orderAsc;
}
break;
}
$out = array(
'pagination' => array(),
'rows' => array()
);
SqlHelper::rawQueryPage(
myself()->_getMySql(''),
'SELECT * FROM t_ingame_mall WHERE buyer=:buyer AND status=:status',
array(
':buyer' => myself()->_getAccountId(),
':status' => Mall::BUY_OK_STATE,
),
array(
'page' => $page,
'perPage' => 10,
'orderBy' => $orderBy,
'handle' => function ($row) use(&$out) {
array_push($out['rows'], $row);
}
),
$out['pagination']
);
myself()->_rspData($out);
} }
public function shoppingCartList(){ public function shoppingCartList(){