From 343a36b0bb22ecebc2c54aadd2afe31d51f7f288 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 15 Dec 2022 11:44:19 +0800 Subject: [PATCH] ... --- .gitignore | 1 + webapp/controller/MarketController.class.php | 66 ++++++++++++++++++-- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 15c2cfcd..b0dba552 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ nginx.htaccess .idea/ .vscode/ webapp/logs +._* diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 3be14b33..b84ab3c6 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -578,7 +578,8 @@ class MarketController extends BaseController { if (in_array($row['info']['info']['job'], $job)==false) continue; if ($row['detail']['hero_lv']<$lv) continue; if (count($search)>0) { - if (!(in_array($row['detail']['hero_name'], $search) || in_array($row['detail']['token_id'], $search))) continue; + $searchLower = array_map('strtolower', $search); + if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; } array_push($nfts, $row); } @@ -666,17 +667,69 @@ class MarketController extends BaseController { $job_filter_array = explode('|', $job_filters); $search_filters = getReqVal('search_filters', ''); $search_filter_array = explode('|', $search_filters); - $lv_filter = getReqVal('lv_filter', 15); + $lv_filter = getReqVal('lv_filter', 1); + $quality_filter = getReqVal('quality_filter', 1); + $durability_filter = getReqVal('durability_filter', 0); $price_filter = getReqVal('price_filter', ''); $price_filter_array = explode('|', $price_filter); + $job_filter_fn = function ($f) { + return ''; + }; + $lv_filter_fn = function ($f) { + $f = (int) $f; + return 'AND c_lv>=' . $f. ' '; + }; + $quality_filter_fn = function ($f) { + $f = (int) $f; + return 'AND c_quality>=' . $f. ' '; + }; + $durability_filter_fn = function ($f) { + $f = (int) $f; + return 'AND c_durability>=' . $f. ' '; + }; + $search_filter_fn = function ($f) { + return ''; + }; + + $order_fn = function ($method, $asc) { + switch ($method) { + case 2: + return 'ORDER BY s_price ' . ($asc == 0 ? 'ASC' : 'DESC' . ' '); + break; + case 3: + return 'ORDER BY c_quality ' . ($asc == 0 ? 'ASC' : 'DESC' . ' '); + break; + case 4: + return 'ORDER BY c_lv ' . ($asc == 0 ? 'ASC' : 'DESC' . ' '); + break; + case 5: + return 'ORDER BY c_durability ' . ($asc == 0 ? 'ASC' : 'DESC' . ' '); + break; + + // 所有其他不正常的排序都执行最新上架 + case 1: + default: + return 'ORDER BY createtime ' . ($asc == 0 ? 'ASC' : 'DESC' . ' '); + break; + } + return ''; + }; + $conn = myself()->_getMysql(''); - $rows = SqlHelper::ormSelect( - $conn, - 't_market_store', + $rows = $conn->execQuery( + 'SELECT * FROM t_market_store '. + 'WHERE token_type=:token_type '. + $job_filter_fn($job_filter_array). + $lv_filter_fn($lv_filter). + $quality_filter_fn($quality_filter). + $durability_filter_fn($durability_filter). + $search_filter_fn($search_filter_array). + $order_fn($order_method, $order_asc). + 'LIMIT '.$start.','.$page_size, array( - 'token_type' => $type + ':token_type' => $type, ) ); @@ -777,6 +830,7 @@ class MarketController extends BaseController { } public function sellMyNft() { + $account = getReqVal('account', ''); $token = getReqVal('token', ''); $nft_token = getReqVal('nft_token', '');