From ce9cf48da22358ba00d8b42899f22ba5c1e260e9 Mon Sep 17 00:00:00 2001 From: songliang Date: Sat, 28 Jan 2023 13:31:41 +0800 Subject: [PATCH] ... --- doc/Market.py | 1 + webapp/controller/MarketController.class.php | 22 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doc/Market.py b/doc/Market.py index 26141c6b..c634f3d3 100644 --- a/doc/Market.py +++ b/doc/Market.py @@ -441,6 +441,7 @@ class Market(object): 'url': 'webapp/index.php?c=Market&a=getTransactionRecord', 'params': [ ['account', '', '账号id'], + ['type', 0, '物品类型 0:所有 1:英雄 2:武器 3:芯片 5:碎片'], ['start', 0, '分页开始偏移'], ['page_size', 0, '分页大小'], ], diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 4042a593..31d2a2db 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -978,14 +978,26 @@ class MarketController extends BaseController { public function getTransactionRecord() { $account = strtolower(getReqVal('account', '')); + $type = getReqVal('type', 0); $start = getReqVal('start', 0); $page_size = getReqVal('page_size', 10); $conn = myself()->_getMysql(''); + $type_filter_fn = function ($f) { + if ($f==0) { + return ''; + } + else { + return 'AND type=' . $f; + } + }; + $counts = $conn->execQuery( 'SELECT count(*) as count FROM t_market_transaction_record '. - 'WHERE seller=:account OR buyer=:account ORDER BY createtime DESC', + 'WHERE (seller=:account OR buyer=:account) '. + $type_filter_fn($type). + ' ORDER BY createtime DESC', array( ':account' => $account, ) @@ -1002,7 +1014,9 @@ class MarketController extends BaseController { $rows = $conn->execQuery( 'SELECT * FROM t_market_transaction_record '. - 'WHERE seller=:account OR buyer=:account ORDER BY createtime DESC '. + 'WHERE (seller=:account OR buyer=:account) '. + $type_filter_fn($type). + ' ORDER BY createtime DESC '. 'LIMIT '.$start.','.$page_size, array( ':account' => $account, @@ -1131,7 +1145,7 @@ class MarketController extends BaseController { $conn = myself()->_getMysql(''); // 1. check order status - $chk = SqlHelper::selectOne($conn, 't_market_store', array('status','idx', 'c_name', 'c_type'), array('o_link' => $orderId)); + $chk = SqlHelper::selectOne($conn, 't_market_store', array('status','idx', 'c_name', 'token_type'), array('o_link' => $orderId)); if (empty($chk)) { $this->_rspErr(1, 'not found order, orderId='.$orderId); return; @@ -1158,7 +1172,7 @@ class MarketController extends BaseController { 'tokenid' => $tokenId, 'amount' => $amount, 'name' => $chk['c_name'], - 'type' => $chk['c_type'], + 'type' => $chk['token_type'], ); $this->addTransactionRecord($record); $this->_rspOk();