From 79d259284f40f2ae1c275140f38d8f34c1d52382 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 17:13:42 +0800 Subject: [PATCH 1/9] ... --- doc/Shop.py | 3 ++- .../controller/BaseAuthedController.class.php | 22 +++++++++++-------- webapp/controller/ShopController.class.php | 5 ++++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/doc/Shop.py b/doc/Shop.py index 1eb0768b..331f0d85 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -187,7 +187,8 @@ class Shop(object): 'response': [ _common.RspHead(), ['idx', 0, '每日精选的索引'], - ['cost', 0, '每日精选的当前刷新价格'], + ['refresh_info', '', '每日精选的刷新信息(格式:刷新次数/可刷新总数)'], + ['cost', 0, '每日精选的当前刷新价格,null表示不可刷新'], ['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'], ] }, diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index c42afa00..1a64b8a9 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -86,15 +86,19 @@ class BaseAuthedController extends BaseController { } $r = $this->_getRedis($this->_getAccountId()); $sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); - if (empty($sessionId)) { - $this->updateSession(myself()->_getAccountId(), - myself()->_getSessionId()); - } else if ($sessionId != $this->_getSessionId()) { - error_log('session expiration' . json_encode( - $_REQUEST - )); - phpcommon\sendError(1001, 'session expiration'); - die(); + error_log('SERVER_ENV:' . SERVER_ENV . '_DEBUG:' . _DEBUG); + if (SERVER_ENV != _DEBUG) + { + if (empty($sessionId)) { + $this->updateSession(myself()->_getAccountId(), + myself()->_getSessionId()); + } else if ($sessionId != $this->_getSessionId()) { + error_log('session expiration' . json_encode( + $_REQUEST + )); + phpcommon\sendError(1001, 'session expiration'); + die(); + } } $this->_userLvRestriction(); diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 61499f3f..371a1ad6 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -418,11 +418,14 @@ class ShopController extends BaseAuthedController $count = $this->countTodayRefreshTimes($address); $costs = mt\Parameter::getByName('daily_selection_refresh_cost'); $arrCosts = explode('|', $costs['param_value']); - $cost = $count < count($arrCosts) ? $arrCosts[$count] : null; + + $max_count = count($arrCosts); + $cost = $count < $max_count ? $arrCosts[$count] : null; $this->_rspData( array( 'idx' => $selection['idx'], + 'refresh_info' => "{$count}/{$max_count}", 'cost' => $cost, 'goods_list' => $goodsList, ) From a187ac57c05abfd655484675eafb4ebd5e997fc0 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 17:18:53 +0800 Subject: [PATCH 2/9] ... --- webapp/controller/BaseAuthedController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 1a64b8a9..0a6da045 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -86,7 +86,7 @@ class BaseAuthedController extends BaseController { } $r = $this->_getRedis($this->_getAccountId()); $sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId()); - error_log('SERVER_ENV:' . SERVER_ENV . '_DEBUG:' . _DEBUG); + // error_log('SERVER_ENV:' . SERVER_ENV . '_DEBUG:' . _DEBUG); if (SERVER_ENV != _DEBUG) { if (empty($sessionId)) { From 5e86492407fa95a417797ebe634385b565891d3a Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 17:30:15 +0800 Subject: [PATCH 3/9] ... --- webapp/controller/MarketController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 74f582a5..acf5978f 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -912,7 +912,7 @@ class MarketController extends BaseController { $signature = getReqVal('signature', ''); $net_id = getReqVal('net_id', ''); - $conn = myself()->_getMysql(''); + $conn = myself()->_getMarketMysql(''); $nftDb = Nft::findNftByOwner($account, $nft_token); $nftDetail = Nft::toDto($nftDb); From 2c6fec6cd2af2be64dd29ecaaadc2f0e8b1ead9d Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 17:37:58 +0800 Subject: [PATCH 4/9] ... --- webapp/controller/ShopController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 371a1ad6..12c501fe 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -420,7 +420,7 @@ class ShopController extends BaseAuthedController $arrCosts = explode('|', $costs['param_value']); $max_count = count($arrCosts); - $cost = $count < $max_count ? $arrCosts[$count] : null; + $cost = $count < $max_count ? $arrCosts[$count] : -1; $this->_rspData( array( From d901f44ce707eacd449d169af9d6a7999551bf8c Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 17:38:51 +0800 Subject: [PATCH 5/9] ... --- doc/Shop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Shop.py b/doc/Shop.py index 331f0d85..224040c6 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -188,7 +188,7 @@ class Shop(object): _common.RspHead(), ['idx', 0, '每日精选的索引'], ['refresh_info', '', '每日精选的刷新信息(格式:刷新次数/可刷新总数)'], - ['cost', 0, '每日精选的当前刷新价格,null表示不可刷新'], + ['cost', 0, '每日精选的当前刷新价格,-1表示不可刷新'], ['!goods_list', [_common.DailySelectionGoods()], '每日精选列表'], ] }, From 5e0364ed736d8ced20aca3ecd15097518b06a401 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 21:52:37 +0800 Subject: [PATCH 6/9] ... --- webapp/controller/MarketController.class.php | 691 ++++++++++++------- 1 file changed, 430 insertions(+), 261 deletions(-) diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index acf5978f..485dc856 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -35,14 +35,15 @@ use services\MarketService; use services\LuckyBoxService; use services\ActivateNftService; -class MarketController extends BaseController { +class MarketController extends BaseController +{ public function getPreSaleInfo() { $account = strtolower(getReqVal('account', '')); $presaleInfo = MarketService::getPreSaleInfo($account); if (MarketService::isTestMode()) { - foreach(array_keys($presaleInfo) as $key) { + foreach (array_keys($presaleInfo) as $key) { if (!is_null(getReqVal($key, null))) { $presaleInfo[$key] = getReqVal($key, $presaleInfo[$key]); } @@ -69,7 +70,7 @@ class MarketController extends BaseController { 'current_page' => $page, 'total_pages' => 0 ); - $startPos= $pageInfo['per_page'] * ($pageInfo['current_page'] - 1); + $startPos = $pageInfo['per_page'] * ($pageInfo['current_page'] - 1); $currBatchMeta = mt\MarketBatch::getCurrentBatch(); if ($currBatchMeta) { @@ -79,8 +80,10 @@ class MarketController extends BaseController { $saleBox = $this->fillPresaleBox($currBatchMeta, $meta); if ($saleBox) { ++$pageInfo['total']; - if ($pageInfo['total'] > $startPos && - count($rows) < $pageInfo['per_page']) { + if ( + $pageInfo['total'] > $startPos && + count($rows) < $pageInfo['per_page'] + ) { array_push($rows, $saleBox); } } @@ -119,7 +122,8 @@ class MarketController extends BaseController { $paymentTokenAddress, $price, $nonce, - $signature); + $signature + ); $batchIdx = 0; $idx = 0; @@ -129,12 +133,14 @@ class MarketController extends BaseController { return; } - if (empty($type) || + if ( + empty($type) || empty($buyerAddress) || empty($price) || empty($paymentTokenAddress) || empty($signature) || - empty($nonce)) { + empty($nonce) + ) { myself()->_rspErr(2, 'parameter error'); return; } @@ -159,7 +165,7 @@ class MarketController extends BaseController { } $originalPrice = $goodsMeta['price'] * pow(10, MarketService::CURRENCY_DECIMALS); $discountPrice = $goodsMeta['discount'] * 100 > 0 ? - $originalPrice * $goodsMeta['discount'] : $originalPrice; + $originalPrice * $goodsMeta['discount'] : $originalPrice; $discountPrice .= MarketService::PRICE_PAD; if (!$discountPrice || strcmp($price, $discountPrice) != 0) { @@ -192,32 +198,36 @@ class MarketController extends BaseController { return; } - if (!MarketService::isTestMode() && - BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])) { + if ( + !MarketService::isTestMode() && + BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id']) + ) { myself()->_rspErr(1, 'account can only choose 1 hero to purchase'); return; } - $orderId = BuyRecord::genOrderId($gameId, - $funcId, - myself()->_getNowTime(), - $buyerAddress); + $orderId = BuyRecord::genOrderId( + $gameId, + $funcId, + myself()->_getNowTime(), + $buyerAddress + ); $fieldsKv = array( - 'game_id' => $gameId, - 'func_id' => $funcId, - 'batch_idx' => $currBatchMeta['id'], - 'type' => $type, - 'raw_buyer_address' => $rawBuyerAddress, - 'buyer_address' => $buyerAddress, - 'price' => $price, - 'payment_token_address' => $paymentTokenAddress, - 'nonce' => $nonce, - 'signature' => $signature, - 'net_id' => $netId, - 'done' => 0, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ); + 'game_id' => $gameId, + 'func_id' => $funcId, + 'batch_idx' => $currBatchMeta['id'], + 'type' => $type, + 'raw_buyer_address' => $rawBuyerAddress, + 'buyer_address' => $buyerAddress, + 'price' => $price, + 'payment_token_address' => $paymentTokenAddress, + 'nonce' => $nonce, + 'signature' => $signature, + 'net_id' => $netId, + 'done' => 0, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ); $items = array(); MarketService::openBox($itemMeta, $items); for ($i = 1; $i <= BoxOrder::MAX_NFT_NUM; ++$i) { @@ -317,7 +327,7 @@ class MarketController extends BaseController { ), ) ), - 'handle' => function ($row) use(&$nftDbList) { + 'handle' => function ($row) use (&$nftDbList) { #error_log(json_encode($row)); array_push($nftDbList, $row); } @@ -385,7 +395,7 @@ class MarketController extends BaseController { public function auth() { $account = strtolower(getReqVal('account', '')); - $tips = getReqVal('tips', '') ; + $tips = getReqVal('tips', ''); $nonce = getReqVal('nonce', ''); $signature = getReqVal('signature', ''); MarketService::auth($account, $tips, $nonce, $signature); @@ -397,17 +407,18 @@ class MarketController extends BaseController { if (!$currencyMeta) { return null; } - $boxId = phpcommon\genBoxId($batchMeta['id'], - $goodsMeta['id'], - $goodsMeta['item_id']); + $boxId = phpcommon\genBoxId( + $batchMeta['id'], + $goodsMeta['id'], + $goodsMeta['item_id'] + ); $itemMeta = mt\Item::get($goodsMeta['item_id']); $originalPrice = $goodsMeta['price'] * pow(10, MarketService::CURRENCY_DECIMALS); $discountPrice = $goodsMeta['discount'] * 100 > 0 ? - $originalPrice * $goodsMeta['discount'] : $originalPrice; + $originalPrice * $goodsMeta['discount'] : $originalPrice; $name = ''; - $job = 0; - { + $job = 0; { $heroMeta = mt\Hero::get($goodsMeta['item_id']); if ($heroMeta) { $name = emptyReplace($heroMeta['name'], 'Hill'); @@ -429,7 +440,8 @@ class MarketController extends BaseController { 'decimals' => MarketService::CURRENCY_DECIMALS, 'contract_address' => $currencyMeta['address'], ) - )); + ) + ); return $saleBox; } @@ -547,22 +559,22 @@ class MarketController extends BaseController { $sortByLevel = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_lv'] - $a['detail']['hero_lv']); }; - $sortByGunLv = function ($a, $b) use($order_asc) { + $sortByGunLv = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['gun_lv'] - $a['detail']['gun_lv']); }; - $sortByTili = function ($a, $b) use($order_asc) { + $sortByTili = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_tili'] - $a['detail']['hero_tili']); }; - $sortByStar = function ($a, $b) use($order_asc) { + $sortByStar = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['quality'] - $a['detail']['quality']); }; - $sortByDurability = function ($a, $b) use($order_asc) { + $sortByDurability = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['durability_max'] - $a['detail']['durability_max']); }; - $sortByPower = function ($a, $b) use($order_asc) { + $sortByPower = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['strength'] - $a['detail']['strength']); }; - $sortByGrade = function ($a, $b) use($order_asc) { + $sortByGrade = function ($a, $b) use ($order_asc) { return ($order_asc == 1 ? 1 : -1) * ($b['detail']['chip_grade'] - $a['detail']['chip_grade']); }; $sortByTokenId = function ($a, $b) use ($order_asc) { @@ -580,11 +592,11 @@ class MarketController extends BaseController { } $row['info'] = Nft::toDto($nftDb); $row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id'])); - if (in_array($row['info']['info']['job'], $job)==false) continue; - if ($row['detail']['hero_lv']<$lv) continue; - if ($row['detail']['quality']<$quality) continue; - if ($row['detail']['hero_tili']<$durability) continue; - if (count($search)>0) { + if (in_array($row['info']['info']['job'], $job) == false) continue; + if ($row['detail']['hero_lv'] < $lv) continue; + if ($row['detail']['quality'] < $quality) continue; + if ($row['detail']['hero_tili'] < $durability) continue; + if (count($search) > 0) { $searchLower = array_map('strtolower', $search); if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; } @@ -592,15 +604,15 @@ class MarketController extends BaseController { array_push($nfts, $row); } switch ($order_method) { - case 1: - usort($nfts, $sortByLevel); - break; - case 2: - usort($nfts, $sortByTili); - break; - case 3: - usort($nfts, $sortByStar); - break; + case 1: + usort($nfts, $sortByLevel); + break; + case 2: + usort($nfts, $sortByTili); + break; + case 3: + usort($nfts, $sortByStar); + break; } } break; @@ -614,10 +626,10 @@ class MarketController extends BaseController { } $row['info'] = Nft::toDto($nftDb); $row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id'])); - if ($row['detail']['gun_lv']<$lv) continue; - if ($row['detail']['quality']<$quality) continue; - if ($row['detail']['durability']<$durability) continue; - if (count($search)>0) { + if ($row['detail']['gun_lv'] < $lv) continue; + if ($row['detail']['quality'] < $quality) continue; + if ($row['detail']['durability'] < $durability) continue; + if (count($search) > 0) { $searchLower = array_map('strtolower', $search); if (!(in_array(strtolower($row['detail']['gun_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; } @@ -625,15 +637,15 @@ class MarketController extends BaseController { array_push($nfts, $row); } switch ($order_method) { - case 1: - usort($nfts, $sortByGunLv); - break; - case 2: - usort($nfts, $sortByDurability); - break; - case 3: - usort($nfts, $sortByStar); - break; + case 1: + usort($nfts, $sortByGunLv); + break; + case 2: + usort($nfts, $sortByDurability); + break; + case 3: + usort($nfts, $sortByStar); + break; } } break; @@ -644,20 +656,20 @@ class MarketController extends BaseController { $row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id'])); if (!in_array($row['detail']['chip_type'], $job)) continue; - if ($row['detail']['chip_grade']<$lv) continue; - if (count($search)>0) { + if ($row['detail']['chip_grade'] < $lv) continue; + if (count($search) > 0) { $searchLower = array_map('strtolower', $search); if (!(in_array(strtolower($row['detail']['chip_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; } array_push($nfts, $row); } switch ($order_method) { - case 1: - usort($nfts, $sortByGrade); - break; - case 2: - usort($nfts, $sortByPower); - break; + case 1: + usort($nfts, $sortByGrade); + break; + case 2: + usort($nfts, $sortByPower); + break; } } break; @@ -672,7 +684,7 @@ class MarketController extends BaseController { $row['detail'] = $this->getNftGameData($nftDb); if (!in_array($row['detail']['type'], $job)) continue; - if (count($search)>0) { + if (count($search) > 0) { $searchLower = array_map('strtolower', $search); if (!(in_array(strtolower($row['detail']['name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; } @@ -682,7 +694,6 @@ class MarketController extends BaseController { } break; default: { - } } return $nfts; @@ -710,19 +721,19 @@ class MarketController extends BaseController { $job_filter_fn = function ($f) { $str = ''; $arr = array(); - foreach($f as $v) { + foreach ($f as $v) { if (!empty($v)) { array_push($arr, 'c_job=\'' . $v . '\' '); } } - if (count($arr)>0) { + if (count($arr) > 0) { $str = implode('OR ', $arr); $str = 'AND (' . $str . ') '; } return $str; }; $price_filter_fn = function ($f) { - if (count($f)==2) { + if (count($f) == 2) { $low = $f[0]; $top = $f[1]; return 'AND s_price>=' . $low . ' AND s_price<=' . $top . ' '; @@ -731,25 +742,25 @@ class MarketController extends BaseController { }; $lv_filter_fn = function ($f) { $f = (int) $f; - return 'AND c_lv>=' . $f. ' '; + return 'AND c_lv>=' . $f . ' '; }; $quality_filter_fn = function ($f) { $f = (int) $f; - return 'AND c_quality>=' . $f. ' '; + return 'AND c_quality>=' . $f . ' '; }; $durability_filter_fn = function ($f) { $f = (int) $f; - return 'AND c_durability>=' . $f. ' '; + return 'AND c_durability>=' . $f . ' '; }; $search_filter_fn = function ($f) { $str = ''; $arr_options = array(); - foreach($f as $v) { + foreach ($f as $v) { if (!empty($v)) { - array_push($arr_options,'c_name=\'' . $v . '\' OR token_id=\'' . $v. '\' '); + array_push($arr_options, 'c_name=\'' . $v . '\' OR token_id=\'' . $v . '\' '); } } - if (count($arr_options)>0) { + if (count($arr_options) > 0) { $str = implode('OR ', $arr_options); $str = 'AND (' . $str . ') '; } @@ -771,7 +782,7 @@ class MarketController extends BaseController { return 'ORDER BY c_durability ' . ($asc == 0 ? 'ASC' : 'DESC') . ' '; break; - // 所有其他不正常的排序都执行最新上架 + // 所有其他不正常的排序都执行最新上架 case 1: default: return 'ORDER BY createtime ' . ($asc == 0 ? 'ASC' : 'DESC') . ' '; @@ -783,15 +794,15 @@ class MarketController extends BaseController { $conn = myself()->_getMarketMysql(''); $counts = $conn->execQuery( - 'SELECT count(*) as count FROM t_market_store '. - 'WHERE token_type=:token_type AND status=0 '. - $job_filter_fn($job_filter_array). - $lv_filter_fn($lv_filter). - $quality_filter_fn($quality_filter). - $durability_filter_fn($durability_filter). - $price_filter_fn($price_filter_array). - $search_filter_fn($search_filter_array). - $order_fn($order_method, $order_asc), + 'SELECT count(*) as count FROM t_market_store ' . + 'WHERE token_type=:token_type AND status=0 ' . + $job_filter_fn($job_filter_array) . + $lv_filter_fn($lv_filter) . + $quality_filter_fn($quality_filter) . + $durability_filter_fn($durability_filter) . + $price_filter_fn($price_filter_array) . + $search_filter_fn($search_filter_array) . + $order_fn($order_method, $order_asc), array( ':token_type' => $type, ) @@ -801,31 +812,31 @@ class MarketController extends BaseController { $page_end = $start + $page_size; if ($page_end > $total) { $page_end = $total; - $start = $total-1; + $start = $total - 1; $start = intval($start / $page_size) * $page_size; - if ($start<0) $start = 0; + if ($start < 0) $start = 0; } $rows = $conn->execQuery( - 'SELECT * FROM t_market_store '. - 'WHERE token_type=:token_type AND status=0 '. - $job_filter_fn($job_filter_array). - $lv_filter_fn($lv_filter). - $quality_filter_fn($quality_filter). - $durability_filter_fn($durability_filter). - $price_filter_fn($price_filter_array). - $search_filter_fn($search_filter_array). - $order_fn($order_method, $order_asc). - 'LIMIT '.$start.','.$page_size, + 'SELECT * FROM t_market_store ' . + 'WHERE token_type=:token_type AND status=0 ' . + $job_filter_fn($job_filter_array) . + $lv_filter_fn($lv_filter) . + $quality_filter_fn($quality_filter) . + $durability_filter_fn($durability_filter) . + $price_filter_fn($price_filter_array) . + $search_filter_fn($search_filter_array) . + $order_fn($order_method, $order_asc) . + 'LIMIT ' . $start . ',' . $page_size, array( ':token_type' => $type, ) ); - + $nfts = array(); - + for ($x = $start; $x < $page_end; $x++) { - $row = $rows[$x%$page_size]; + $row = $rows[$x % $page_size]; $nftDb = Nft::getNft($row['token_id']); if (!$nftDb) { $nftDb = Nft::findNftByOwner($account, $row['token_id']); @@ -833,8 +844,13 @@ class MarketController extends BaseController { if (!$nftDb) { $nftDb = Nft::findNftByOwner('0xfc628dd79137395f3c9744e33b1c5de554d94882', $row['token_id']); if (!$nftDb) { - myself()->_rspErr(1, 'nft not exists'); - return; + if ($row['item_id']) { + + } else { + myself()->_rspErr(1, 'nft not exists'); + return; + } + } } } @@ -843,7 +859,7 @@ class MarketController extends BaseController { $row['detail'] = $this->getNftGameData($nftDb); array_push($nfts, $row); } - + $this->_rspData(array( "total" => $total, "start" => $start, @@ -864,34 +880,34 @@ class MarketController extends BaseController { $job_filters = getReqVal('job_filters', ''); $job_filter_array = explode('|', $job_filters); $search_filters = getReqVal('search_filters', ''); - if ($search_filters!='') { + if ($search_filters != '') { $search_filter_array = explode('|', $search_filters); } else { $search_filter_array = array(); } - + $lv_filter = getReqVal('lv_filter', 0); $quality_filter = getReqVal('quality_filter', 0); $durability_filter = getReqVal('durability_filter', 0); - + $rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter, $quality_filter, $durability_filter); - - $total = count($rows); + + $total = count($rows); $page_end = $start + $page_size; if ($page_end > $total) { $page_end = $total; - $start = $total-1; + $start = $total - 1; $start = intval($start / $page_size) * $page_size; - if ($start<0) $start = 0; + if ($start < 0) $start = 0; } - + $nfts = array(); for ($x = $start; $x < $page_end; $x++) { $row = $rows[$x]; // $this->attach_market_selling($row); array_push($nfts, $row); } - + $this->_rspData(array( "total" => $total, "start" => $start, @@ -900,50 +916,96 @@ class MarketController extends BaseController { )); } - public function sell() { + public function sell() + { + $self = myself(); + if (!$self) { + $this->_rspErr(500, 'internal error, no self'); + return; + } + $account = strtolower(getReqVal('account', '')); - $item_id = getReqVal('item_id', ''); $token = getReqVal('token', ''); + $nft_token = getReqVal('nft_token', ''); + $item_id = getReqVal('item_id', ''); + $s_price = getReqVal('s_price', ''); $amount = getReqVal('amount', 1); + $payment_token_address = getReqVal('payment_token_address', ''); $nonce = getReqVal('nonce', ''); $signature = getReqVal('signature', ''); $net_id = getReqVal('net_id', ''); - - $conn = myself()->_getMarketMysql(''); - $nftDb = Nft::findNftByOwner($account, $nft_token); - $nftDetail = Nft::toDto($nftDb); - $detail = $this->getNftGameData($nftDb); + $conn = $self->_getMarketMysql(''); + + $nftDb = null; + + $c_name = null; + $c_job = null; + $c_lv = null; + $c_quality = null; + $c_durability = null; + $c_type = null; + $c_id = null; + + if ($nft_token) { + $nftDb = Nft::findNftByOwner($account, $nft_token); + $nftDetail = Nft::toDto($nftDb); + $detail = $this->getNftGameData($nftDb); + $c_name = $nftDetail['info']['name']; + $c_job = isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] + : (isset($detail['chip_type']) ? $detail['chip_type'] + : (isset($detail['type']) ? $detail['type'] + : 0)); + $c_lv = @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade']; + $c_quality = isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0; + $c_durability = isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0); + $c_type = isset($detail['type']) ? $detail['type'] : 0; + $c_id = $nftDetail['item_id']; + } else { + if (!$this->decItems($account, $item_id, $amount)) { + $this->_rspErr(1, 'item not enough, item_id:' . $item_id); + return; + } + $itemMeta = mt\Item::get($item_id); + $c_name = $itemMeta['name']; + $c_job = 0; + $c_lv = 0; + $c_quality = $itemMeta['quality']; + $c_durability = 0; + $c_type = 0; + $c_id = $item_id; + } + $r = SqlHelper::insert( $conn, 't_market_store', array( 'token_id' => $nft_token, - 'token_type' => $nftDetail['type'], - 'owner' => $account, - 'price' => $s_price, + 'item_id' => $item_id, + 'owner_address' => $account, + 'token_type' => 0, 'amount' => $amount, - 'payment_token_address' => $payment_token_address, - 'status' => 0, - 'create_time' => time(), - 'update_time' => time(), + 'createtime' => $self->_getNowTime(), + 'modifytime' => $self->_getNowTime(), + 's_price' => $s_price, + 'c_name' => $c_name, + 'c_job' => $c_job, + 'c_lv' => $c_lv, + 'c_quality' => $c_quality, + 'c_durability' => $c_durability, + 'c_type' => $c_type, + 'c_id' => $c_id, ) ); - if (!$r) { - myself()->_rspErr(1, 'insert error'); - return; - } - $this->_rspData(array( - 'nft' => $nftDetail, - 'detail' => $detail, - )); + $this->_rspOk(); } - public function sellMyNft() { - + private function sellMyNft() + { + $account = strtolower(getReqVal('account', '')); $token = getReqVal('token', ''); $nft_token = getReqVal('nft_token', ''); @@ -953,8 +1015,8 @@ class MarketController extends BaseController { $nonce = getReqVal('nonce', ''); $signature = getReqVal('signature', ''); $net_id = getReqVal('net_id', ''); - - $conn = myself()->_getMysql(''); + + $conn = myself()->_getMarketMysql(''); $nftDb = Nft::findNftByOwner($account, $nft_token); $nftDetail = Nft::toDto($nftDb); @@ -971,10 +1033,10 @@ class MarketController extends BaseController { 'modifytime' => myself()->_getNowTime(), 's_price' => $s_price, 'c_name' => $nftDetail['info']['name'], - 'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] - : (isset($detail['chip_type']) ? $detail['chip_type'] - : (isset($detail['type'])?$detail['type'] - :0)), + 'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] + : (isset($detail['chip_type']) ? $detail['chip_type'] + : (isset($detail['type']) ? $detail['type'] + : 0)), 'c_lv' => @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'], 'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0, 'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0), @@ -985,7 +1047,8 @@ class MarketController extends BaseController { $this->_rspOk(); } - public function buyNft() { + public function buyNft() + { $account = strtolower(getReqVal('account', '')); $token = getReqVal('token', ''); $nft_token = getReqVal('nft_token', ''); @@ -995,12 +1058,13 @@ class MarketController extends BaseController { $net_id = getReqVal('net_id', ''); $conn = myself()->_getMarketMysql(''); - $conn->execScript('DELETE FROM t_market_store WHERE '.'token_id=\''.$nft_token.'\''); + $conn->execScript('DELETE FROM t_market_store WHERE ' . 'token_id=\'' . $nft_token . '\''); $this->_rspOk(); } - public function getSupportedCurrencyTypes() { + public function getSupportedCurrencyTypes() + { $types = array(); if (SERVER_ENV == _ONLINE) { array_push($types, array( @@ -1018,28 +1082,28 @@ class MarketController extends BaseController { )); } - public function getTransactionRecord() { + public function getTransactionRecord() + { $account = strtolower(getReqVal('account', '')); $type = getReqVal('type', 0); $start = getReqVal('start', 0); $page_size = getReqVal('page_size', 10); - $conn = myself()->_getMysql(''); + $conn = myself()->_getMarketMysql(''); $type_filter_fn = function ($f) { - if ($f==0) { + if ($f == 0) { return ''; - } - else { + } else { return 'AND type=' . $f; } }; $counts = $conn->execQuery( - 'SELECT count(*) as count FROM t_market_transaction_record '. - 'WHERE (seller=:account OR buyer=:account) '. - $type_filter_fn($type). - ' ORDER BY createtime DESC', + 'SELECT count(*) as count FROM t_market_transaction_record ' . + 'WHERE (seller=:account OR buyer=:account) ' . + $type_filter_fn($type) . + ' ORDER BY createtime DESC', array( ':account' => $account, ) @@ -1049,17 +1113,17 @@ class MarketController extends BaseController { $page_end = $start + $page_size; if ($page_end > $total) { $page_end = $total; - $start = $total-1; + $start = $total - 1; $start = intval($start / $page_size) * $page_size; - if ($start<0) $start = 0; + if ($start < 0) $start = 0; } $rows = $conn->execQuery( - 'SELECT * FROM t_market_transaction_record '. - 'WHERE (seller=:account OR buyer=:account) '. - $type_filter_fn($type). - ' ORDER BY createtime DESC '. - 'LIMIT '.$start.','.$page_size, + 'SELECT * FROM t_market_transaction_record ' . + 'WHERE (seller=:account OR buyer=:account) ' . + $type_filter_fn($type) . + ' ORDER BY createtime DESC ' . + 'LIMIT ' . $start . ',' . $page_size, array( ':account' => $account, ) @@ -1073,8 +1137,9 @@ class MarketController extends BaseController { )); } - private function addTransactionRecord($record) { - $conn = myself()->_getMysql(''); + private function addTransactionRecord($record) + { + $conn = myself()->_getMarketMysql(''); $r = SqlHelper::insert( $conn, @@ -1082,11 +1147,12 @@ class MarketController extends BaseController { $record ); if (!$r) { - $this->_rspErr(2, 'unknown error, orderId='.$record['orderid']); + $this->_rspErr(2, 'unknown error, orderId=' . $record['orderid']); } } - public function eventSellOrder() { + public function eventSellOrder() + { $tokenId = getReqVal('tokenId', ''); $owner = strtolower(getReqVal('owner', '')); $nftToken = getReqVal('nftToken', ''); @@ -1095,18 +1161,19 @@ class MarketController extends BaseController { $currency = getReqVal('currency', ''); $price = getReqVal('price', ''); - error_log("eventSellOrder:" . json_encode( - array( - 'tokenId' => $tokenId, - 'owner' => $owner, - 'nftToken' => $nftToken, - 'amount' => $amount, - 'orderId' => $orderId, - 'currency' => $currency, - 'price' => $price, - ), - JSON_PRETTY_PRINT - ) + error_log( + "eventSellOrder:" . json_encode( + array( + 'tokenId' => $tokenId, + 'owner' => $owner, + 'nftToken' => $nftToken, + 'amount' => $amount, + 'orderId' => $orderId, + 'currency' => $currency, + 'price' => $price, + ), + JSON_PRETTY_PRINT + ) ); $conn = myself()->_getMarketMysql(''); @@ -1114,7 +1181,7 @@ class MarketController extends BaseController { // 1. check order status $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); if (!empty($chk)) { - $this->_rspErr(1, 'repeat sell order, orderId='.$orderId); + $this->_rspErr(1, 'repeat sell order, orderId=' . $orderId); return; } @@ -1141,10 +1208,10 @@ class MarketController extends BaseController { 's_currency' => $currency, 's_price' => $price, 'c_name' => $nftDetail['info']['name'], - 'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] - : (isset($detail['chip_type']) ? $detail['chip_type'] - : (isset($detail['type'])?$detail['type'] - :0)), + 'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] + : (isset($detail['chip_type']) ? $detail['chip_type'] + : (isset($detail['type']) ? $detail['type'] + : 0)), 'c_lv' => @$detail['gun_lv'] | @$detail['hero_lv'] | @$detail['chip_grade'], 'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0, 'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : (isset($detail['hero_tili']) ? $detail['hero_tili'] : 0), @@ -1153,13 +1220,14 @@ class MarketController extends BaseController { ) ); if (!$r) { - $this->_rspErr(2, 'unknown error, orderId='.$orderId); + $this->_rspErr(2, 'unknown error, orderId=' . $orderId); } $this->_rspOk(); } - public function eventBuyOrder() { + public function eventBuyOrder() + { $tokenId = getReqVal('tokenId', ''); $orderId = getReqVal('orderId', ''); $nftToken = getReqVal('nftToken', ''); @@ -1169,30 +1237,31 @@ class MarketController extends BaseController { $erc20 = getReqVal('erc20', ''); $price = getReqVal('price', ''); - error_log("eventBuyOrder:" . json_encode( - array( - 'tokenId' => $tokenId, - 'orderId' => $orderId, - 'nftToken' => $nftToken, - 'amount' => $amount, - 'seller' => $seller, - 'buyer' => $buyer, - 'erc20' => $erc20, - 'price' => $price, - ), - JSON_PRETTY_PRINT - ) + error_log( + "eventBuyOrder:" . json_encode( + array( + 'tokenId' => $tokenId, + 'orderId' => $orderId, + 'nftToken' => $nftToken, + 'amount' => $amount, + 'seller' => $seller, + 'buyer' => $buyer, + 'erc20' => $erc20, + 'price' => $price, + ), + JSON_PRETTY_PRINT + ) ); $conn = myself()->_getMarketMysql(''); // 1. check order status - $chk = SqlHelper::selectOne($conn, 't_market_store', array('status','idx', 'c_name', 'token_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); + $this->_rspErr(1, 'not found order, orderId=' . $orderId); return; } - if ($chk['status']== '0') { + if ($chk['status'] == '0') { $r = SqlHelper::update( $conn, 't_market_store', @@ -1221,21 +1290,23 @@ class MarketController extends BaseController { return; } } - $this->_rspErr(1, 'order status error, order='.$orderId); + $this->_rspErr(1, 'order status error, order=' . $orderId); } - public function eventCancelOrder() { + public function eventCancelOrder() + { $orderId = getReqVal('orderId', ''); $nftToken = getReqVal('nftToken', ''); $tokenId = getReqVal('tokenId', ''); - error_log("eventCancelOrder:" . json_encode( - array( - 'orderId' => $orderId, - 'nftToken' => $nftToken, - 'tokenId' => $tokenId, - ), - JSON_PRETTY_PRINT - ) + error_log( + "eventCancelOrder:" . json_encode( + array( + 'orderId' => $orderId, + 'nftToken' => $nftToken, + 'tokenId' => $tokenId, + ), + JSON_PRETTY_PRINT + ) ); $conn = myself()->_getMarketMysql(''); @@ -1243,10 +1314,10 @@ class MarketController extends BaseController { // 1. check order status $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); if (empty($chk)) { - $this->_rspErr(1, 'not found order, orderId='.$orderId); + $this->_rspErr(1, 'not found order, orderId=' . $orderId); return; } - if ($chk['status']== '0') { + if ($chk['status'] == '0') { $r = SqlHelper::update( $conn, 't_market_store', @@ -1262,37 +1333,39 @@ class MarketController extends BaseController { return; } } - $this->_rspErr(1, 'order status error, order='.$orderId); + $this->_rspErr(1, 'order status error, order=' . $orderId); } - public function eventPriceUpdateOrder() { + public function eventPriceUpdateOrder() + { $orderId = getReqVal('orderId', '');; $nftToken = getReqVal('nftToken', ''); $tokenId = getReqVal('tokenId', ''); $priceOld = getReqVal('priceOld', ''); $price = getReqVal('price', ''); - error_log("eventPriceUpdateOrder:" . json_encode( - array( - 'orderId' => $orderId, - 'nftToken' => $nftToken, - 'tokenId' => $tokenId, - 'priceOld' => $priceOld, - 'price' => $price, - ), - JSON_PRETTY_PRINT - ) + error_log( + "eventPriceUpdateOrder:" . json_encode( + array( + 'orderId' => $orderId, + 'nftToken' => $nftToken, + 'tokenId' => $tokenId, + 'priceOld' => $priceOld, + 'price' => $price, + ), + JSON_PRETTY_PRINT + ) ); - + $conn = myself()->_getMarketMysql(''); // 1. check order status $chk = SqlHelper::selectOne($conn, 't_market_store', array('status'), array('o_link' => $orderId)); if (empty($chk)) { - $this->_rspErr(1, 'not found order, orderId='.$orderId); + $this->_rspErr(1, 'not found order, orderId=' . $orderId); return; } - if ($chk['status']== '0') { + if ($chk['status'] == '0') { $r = SqlHelper::update( $conn, 't_market_store', @@ -1309,32 +1382,39 @@ class MarketController extends BaseController { } } - $this->_rspErr(1, 'price update failed, orderId='.$orderId); + $this->_rspErr(1, 'price update failed, orderId=' . $orderId); } - private function getNftGameData($nftRowInfo) { + private function getNftGameData($nftRowInfo) + { $t = $nftRowInfo['token_type']; $token_id = $nftRowInfo['token_id']; - switch($t) { + switch ($t) { case Nft::HERO_TYPE: { - return $this->appendChipsInfo(Hero::toDtoInfo(Hero::findByTokenId2($token_id))); - } break; + return $this->appendChipsInfo(Hero::toDtoInfo(Hero::findByTokenId2($token_id))); + } + break; case Nft::EQUIP_TYPE: { - return $this->appendChipsInfo(Gun::toDtoInfo(Gun::findByTokenId2($token_id))); - } break; + return $this->appendChipsInfo(Gun::toDtoInfo(Gun::findByTokenId2($token_id))); + } + break; case Nft::CHIP_TYPE: { - return Chip::toDto(Chip::getChipByTokenId($token_id)); - } break; + return Chip::toDto(Chip::getChipByTokenId($token_id)); + } + break; case Nft::FRAGMENT_TYPE: { - return Fragment::ToDto($nftRowInfo); - } break; + return Fragment::ToDto($nftRowInfo); + } + break; default: { - } break; + } + break; } return array('unknown' => 'unknown game data type, cannot find data'); } - private function appendChipsInfo($detail) { + private function appendChipsInfo($detail) + { $detail['chips_info'] = array(); if (!empty($detail['chip_ids'])) { $chips = explode('|', $detail['chip_ids']); @@ -1349,12 +1429,13 @@ class MarketController extends BaseController { return $detail; } - private function attach_market_selling(&$row) { + private function attach_market_selling(&$row) + { $conn = myself()->_getMarketMysql(''); $rows = $conn->execQuery( - 'SELECT * FROM t_market_store '. - 'WHERE token_id=:token_id AND owner_address=:owner_address AND status=:status', + 'SELECT * FROM t_market_store ' . + 'WHERE token_id=:token_id AND owner_address=:owner_address AND status=:status', array( ':token_id' => $row['token_id'], ':owner_address' => $row['owner_address'], @@ -1380,8 +1461,8 @@ class MarketController extends BaseController { $conn = myself()->_getMarketMysql(''); $rows = $conn->execQuery( - 'SELECT * FROM t_market_store '. - 'WHERE owner_address=:account AND token_type=:token_type AND status=0 ', + 'SELECT * FROM t_market_store ' . + 'WHERE owner_address=:account AND token_type=:token_type AND status=0 ', array( ':account' => $account, ':token_type' => $type, @@ -1390,4 +1471,92 @@ class MarketController extends BaseController { return $rows; } + + private function decItems($address, $item_id, $amount) + { + return true; + } + + private function getCostItem($address, $item_id) + { + $self = myself(); + if (!$self) { + return null; + } + + $userInfo = $this->getUserInfo($address, array('gold')); + $count = $this->getItemCount($item_id, $userInfo); + + return array( + 'item_id' => $item_id, + 'item_amount' => $count + ); + } + + private function getItemCount($item_id, $userInfo) + { + switch ($item_id) { + case V_ITEM_GOLD: { + return $userInfo['gold']; + } + } + return "0"; + } + + private function getUserInfo($address, $fields) + { + $self = myself(); + if (!$self) { + return null; + } + + // $account_id = $this->getAccountId($address); + // if (!$account_id) { + // return null; + // } + + $conn = $self->_getMysql($address); + $row = SqlHelper::selectOne( + $conn, + 't_user', + $fields, + array( + 'address' => $address + ) + ); + if (empty($row)) { + return null; + } + + return $row; + } + + private function getAccountId($address) + { + $self = myself(); + if (!$self) { + return null; + } + + $row = SqlHelper::selectOne( + $self->_getMysql($address), + 't_user', + array('account_id'), + array( + 'address' => $address + ) + ); + + return $row['account_id']; + } + + private function normalizeWeb3Price($price) + { + $bn1 = phpcommon\bnInit($price * pow(10, 8)); + $bn2 = phpcommon\bnInit('1000000000000000000'); + $ret_price = phpcommon\bnDiv(phpcommon\bnMul($bn1, $bn2), pow(10, 8)); + + // error_log('normalizeWeb3Price: ' . $ret_price . ' ' . $price * pow(10, 8)); + return phpcommon\bnToStr($ret_price); + } } From bac35fac852d6b7449841384fd172fcf80162cfd Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 22:07:01 +0800 Subject: [PATCH 7/9] ... --- webapp/controller/MarketController.class.php | 36 ++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 485dc856..9538e901 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -582,6 +582,40 @@ class MarketController extends BaseController }; $nfts = array(); switch ($type) { + case Nft::NONE_TYPE: { + $rows = Nft::getNftListByType($account, $type); + $rows = array_merge($rows, $this->listMySelledNfts($account, $type)); + foreach ($rows as &$row) { + $nftDb = Nft::findNftByOwner($account, $row['token_id']); + if (empty($nftDb)) { + $nftDb = Nft::getNft($row['token_id']); + } + $row['info'] = Nft::toDto($nftDb); + // $row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id'])); + // if (in_array($row['info']['info']['job'], $job) == false) continue; + // if ($row['detail']['hero_lv'] < $lv) continue; + // if ($row['detail']['quality'] < $quality) continue; + // if ($row['detail']['hero_tili'] < $durability) continue; + if (count($search) > 0) { + $searchLower = array_map('strtolower', $search); + if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue; + } + // $row['detail'] = $this->appendChipsInfo($row['detail']); + array_push($nfts, $row); + } + switch ($order_method) { + case 1: + usort($nfts, $sortByLevel); + break; + case 2: + usort($nfts, $sortByTili); + break; + case 3: + usort($nfts, $sortByStar); + break; + } + } + break; case Nft::HERO_TYPE: { $rows = Nft::getNftListByType($account, $type); $rows = array_merge($rows, $this->listMySelledNfts($account, $type)); @@ -845,12 +879,10 @@ class MarketController extends BaseController $nftDb = Nft::findNftByOwner('0xfc628dd79137395f3c9744e33b1c5de554d94882', $row['token_id']); if (!$nftDb) { if ($row['item_id']) { - } else { myself()->_rspErr(1, 'nft not exists'); return; } - } } } From 448ec0e5c1ef5ea7880ce04e7901e95d26485f07 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 22:09:17 +0800 Subject: [PATCH 8/9] ... --- doc/Market.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/Market.py b/doc/Market.py index c634f3d3..b146b835 100644 --- a/doc/Market.py +++ b/doc/Market.py @@ -403,6 +403,27 @@ class Market(object): _common.RspHead() ] }, + { + 'name': 'sell', + 'desc': '出售NFT', + 'group': 'Market', + 'url': 'webapp/index.php?c=Market&a=sell', + 'params': [ + ['account', '', '账号id'], + ['token', '', 'token'], + ['nft_token', '', 'nft_token'], + ['item_id', '', '道具id,'] + ['s_price', '', '出售价格USDT'], + ['amount', 0, '出售数量'], + ['payment_token_address', '', 'payment_token_address'], + ['nonce', '', 'nonce'], + ['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'], + ['net_id', '', '网络id'], + ], + 'response': [ + _common.RspHead() + ] + }, { 'name': 'buyNft', 'desc': '购买NFT', From 95182f493319e6c53aaa29792a126f7f76183ba6 Mon Sep 17 00:00:00 2001 From: songliang Date: Mon, 3 Jul 2023 22:11:41 +0800 Subject: [PATCH 9/9] ... --- doc/Market.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Market.py b/doc/Market.py index b146b835..fb72cd8a 100644 --- a/doc/Market.py +++ b/doc/Market.py @@ -412,7 +412,7 @@ class Market(object): ['account', '', '账号id'], ['token', '', 'token'], ['nft_token', '', 'nft_token'], - ['item_id', '', '道具id,'] + ['item_id', '', '道具id,'], ['s_price', '', '出售价格USDT'], ['amount', 0, '出售数量'], ['payment_token_address', '', 'payment_token_address'],