From fd6cdc10ca75c47d01994d4858b0e006273d698d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 25 Jun 2024 14:19:39 +0800 Subject: [PATCH 1/6] 1 --- doc/AAMarket.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/AAMarket.py b/doc/AAMarket.py index b2502dff..a7306894 100644 --- a/doc/AAMarket.py +++ b/doc/AAMarket.py @@ -58,6 +58,22 @@ class AAMarket(object): ['highest_price_goods', _common.MarketGoods(), '最高价格商品(如果没则为null)'], ] }, + { + 'method': 'GET', + 'name': '/api/market/product/goods/:net_id/:contract_address/:token_id', + 'desc': '获取单个商品信息', + 'group': '!AAMarket', + 'url': 'https://market-test.kingsome.cn/api/market/product/goods/:net_id/:contract_address/:token_id', + 'params': [ + [':net_id', 0, '链id'], + [':contract_address', '', '合约地址'], + [':token_id', '', 'token_id'], + ], + 'response': [ + _common.RspHead(), + ['data', _common.MarketGoods(), '商品信息(如果没则为null)'], + ] + }, { 'method': 'GET', 'name': '/api/market/product/category/:net_id', From c369ef48cf7e52290291d29243aab152d2578028 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 26 Jun 2024 13:53:31 +0800 Subject: [PATCH 2/6] 1 --- doc/AAMarket.py | 4 ++-- doc/_common.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/AAMarket.py b/doc/AAMarket.py index a7306894..78bdb062 100644 --- a/doc/AAMarket.py +++ b/doc/AAMarket.py @@ -71,7 +71,7 @@ class AAMarket(object): ], 'response': [ _common.RspHead(), - ['data', _common.MarketGoods(), '商品信息(如果没则为null)'], + ['data', _common.MarketGoods(), '商品信息(如果没则为null), 如果未上架则data.event==null'], ] }, { @@ -125,7 +125,7 @@ class AAMarket(object): 'response': [ _common.RspHead(), ['page', _common.StreamPage(), '分页信息'], - ['!rows', [_common.NftInfo()], '数据'], + ['!rows', [_common.AssetNftInfo()], '数据'], ] }, { diff --git a/doc/_common.py b/doc/_common.py index 8aca9ddc..61f9618d 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -1773,3 +1773,23 @@ class MarketGoods(object): ['nft', NftInfo(), 'nft信息'], ['in_shopcart', 0, '商品是否已在购物车里'], ] + +class AssetNftInfo(object): + + def __init__(self): + self.fields = [ + ['net_id', 0, '链id'], + ['contract_address', 0, '合约地址'], + ['token_id', '', 'token id'], + ['owner_address', '', '所有者地址'], + ['meta_url', '', '元数据url'], + ['name', '', 'nft名字'], + ['item_id', 0, '道具id'], + ['on_sale', 0, '是否出售中'], + ['type', '', 'nft类型 1:英雄 11:金砖'], + ['image', '', 'nft图片地址'], + ['detail', Union([ + [NftHeroDetailNew(), '英雄'], + [NftGoldBullionDetail(), '英雄'], + ]), 'nft详细信息'], + ] From 4b6d3498e64f2ec03bff4f58d7c6a67d5946eb33 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 26 Jun 2024 14:00:57 +0800 Subject: [PATCH 3/6] 1 --- .../controller/OutAppNftController.class.php | 2 - webapp/models/GoldBullion.php | 114 ------------------ webapp/services/LoginService.php | 5 - webapp/services/MailApiService.php | 39 ------ 4 files changed, 160 deletions(-) delete mode 100644 webapp/models/GoldBullion.php diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 07481910..1d393b09 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -3,7 +3,6 @@ use phpcommon\SqlHelper; require_once('models/Nft.php'); require_once('models/User.php'); require_once('models/Hero.php'); -require_once('models/GoldBullion.php'); require_once('mt/NftDesc.php'); require_once('mt/Hero.php'); require_once('mt/EconomyAttribute.php'); @@ -11,7 +10,6 @@ require_once('mt/EconomyAttribute.php'); use models\Nft; use models\User; use models\Hero; -use models\GoldBullion; class OutAppNftController extends BaseController { diff --git a/webapp/models/GoldBullion.php b/webapp/models/GoldBullion.php deleted file mode 100644 index c2bf1916..00000000 --- a/webapp/models/GoldBullion.php +++ /dev/null @@ -1,114 +0,0 @@ -_getAddress(); - if (empty($address)) { - return; - } - $rows = SqlHelper::ormSelect( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'open_address' => myself()->_getAddress(), - 'open_status' => self::OPEN_STATUS_PENDING, - 'returned' => 0, - ) - ); - if (count($rows) > 0) { - $confirmedRows = array(); - foreach ($rows as $row) { - $uniqId = self::genUniqId(); - SqlHelper::update( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'idx' => $row['idx'], - 'open_status' => self::OPEN_STATUS_PENDING - ), - array( - 'open_status' => self::OPEN_STATUS_SEND_BEGIN, - 'open_uniqid' => $uniqId - ) - ); - $newRow = SqlHelper::ormSelectOne( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'idx' => $row['idx'], - ) - ); - if (!empty($newRow) && $newRow['open_uniqid'] == $uniqId) { - array_push($confirmedRows, $row); - } - self::doSendAward($confirmedRows); - } - } - } - - public static function doSendAward($confirmedRows) - { - $propertyChgService = new services\PropertyChgService(); - $awardService = new services\AwardService(); - if (empty($confirmedRows)) { - return; - } - foreach ($confirmedRows as $row) { - $items = array( - array( - 'item_id' => V_ITEM_GOLD, - 'item_num' => $row['gold'] - ) - ); - myself()->_addItems($items, $awardService, $propertyChgService); - SqlHelper::update( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'idx' => $row['idx'], - ), - array( - 'account_id' => myself()->_getAccountId(), - 'open_status' => self::OPEN_STATUS_SEND_END, - ) - ); - $content = "[Item Name] has been used successfully, you have received 100,000 gold"; - services\MailApiService::sendOpenGold($row['net_id'], - $row['token_id'], - '', - $content); - } - } - - public static function findByTokenId($tokenId) - { - $row = SqlHelper::ormSelectOne( - myself()->_getSelfMysql(), - 't_gold_bullion', - array( - 'token_id' => $tokenId, - ) - ); - return $row; - } - - private static function genUniqId() - { - $uniqId = uniqid(md5(rand() . rand() . rand() . myself()->_getSessionId()), true); - return $uniqId; - } - -} diff --git a/webapp/services/LoginService.php b/webapp/services/LoginService.php index 851c296d..3a46488a 100644 --- a/webapp/services/LoginService.php +++ b/webapp/services/LoginService.php @@ -2,15 +2,10 @@ namespace services; -require_once('models/GoldBullion.php'); - -use models\GoldBullion; - class LoginService extends BaseService { public function onLogon() { - GoldBullion::onLogin(); } } diff --git a/webapp/services/MailApiService.php b/webapp/services/MailApiService.php index 923abd57..43238b63 100644 --- a/webapp/services/MailApiService.php +++ b/webapp/services/MailApiService.php @@ -8,7 +8,6 @@ class MailApiService extends BaseService { const SELL_UNIKEY_PRE = 'ingame.market.sell:'; const BUY_UNIKEY_PRE = 'ingame.market.buy:'; - const OPEN_GOLD_BULLION_UNIKEY_PRE = 'gold_bullion:open:'; const SELL_MAIL_SUBJECT = 'Item successfully sold'; /* @@ -99,44 +98,6 @@ class MailApiService extends BaseService { ); } - /* - netId: netId - tokenId:tokenid - to:邮件接受方account_id - subject: 邮件标题 - content: 邮件正文 - */ - public function sendOpenGold($netId, $tokenId, $subject, $content) - { - $unikey = self::OPEN_GOLD_BULLION_UNIKEY_PRE . $netId . '_' . $tokenId; - SqlHelper::upsert - (myself()->_getMailMysql(), - 't_sys_mail', - array( - 'unikey' => $unikey - ), - array( - ), - array( - 'unikey' => $unikey, - 'subject' => $subject, - 'content' => $content, - 'recipients' => json_encode(array( - $to - )), - 'attachments' => json_encode(array()), - 'tag1' => 1, - 'tag2' => 3, - 'sendtime' => myself()->_getNowTime(), - 'expiretime' => myself()->_getNowTime() + 3600 * 24 * 365 * 10, - 'user_reg_start_time' => 0, - 'user_reg_end_time' => myself()->_getNowTime() + 3600 * 24 * 365 * 10, - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime() - ) - ); - } - private function adjustAttachments(&$attachments) { if (empty($attachments)) { From dd00406fcd3e6b43297425f92bb0db7b1088910f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 26 Jun 2024 16:44:23 +0800 Subject: [PATCH 4/6] 1 --- sql/gamedb.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 5db510a2..bd34c2eb 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -171,6 +171,7 @@ CREATE TABLE `t_hero` ( `active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count', `activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1:已初始激活', `activate_time` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间', + `on_chain_time` int(11) NOT NULL DEFAULT '0' COMMENT '上链时间', `wealth_attr` mediumblob COMMENT '财富值属性', `seal_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:未封存 1:已封存', `unseal_time` int(11) NOT NULL DEFAULT '0' COMMENT '解开封时间', From 5d72282d745c4f611e9ee18927b291baa8d60918 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 26 Jun 2024 17:43:17 +0800 Subject: [PATCH 5/6] 1 --- webapp/controller/BlockChainController.class.php | 4 ++++ webapp/controller/OutAppNftController.class.php | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 7ecb69d1..d87e09cd 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -129,6 +129,10 @@ class BlockChainController extends BaseAuthedController { myself()->_rspErr(1, 'hero not found'); return; } + if (!$heroDb['seal_type']) { + myself()->_rspErr(1, 'hero no seal'); + return; + } $isMint = true; $tokenId = $heroDb['token_id']; if ($heroDb['token_id'] && $heroDb['activate']) { diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 1d393b09..e3ab0376 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -153,7 +153,7 @@ class OutAppNftController extends BaseController { $NftMeta = \mt\NftDesc::getByItemId($heroDb['hero_id']); $info['name'] = $heroMeta['name']; $info['description'] = $NftMeta['desc']; - $info['image'] = "https://res2.cebggame.com/nft/meta/".$heroDb['hero_id'].'_'.$heroDb['quality'].".gif"; + $info['image'] = "https://res2.counterfire.games/nft/meta/".$heroDb['hero_id'].'_'.$heroDb['quality'].".gif"; array_push($info['attributes'],array( "trait_type" => "level", "value" => intval($heroDb['hero_lv']), @@ -166,7 +166,7 @@ class OutAppNftController extends BaseController { $NftMeta = \mt\NftDesc::getByItemId($nftDb['item_id']); //$info['name'] = $heroMeta['name']; $info['description'] = $NftMeta['desc']; - $info['image'] = "https://res2.cebggame.com/nft/meta/".$nftDb['item_id'].".png"; + $info['image'] = "https://res2.counterfire.games/nft/meta/".$nftDb['item_id'].".png"; } break; } @@ -268,7 +268,7 @@ class OutAppNftController extends BaseController { $info['name'] = $heroMeta['name']; $info['item_id'] = $heroMeta['id']; $info['type'] = $nftDb['token_type']; - $info['image'] = 'https://res2.cebggame.com/nft/meta/' . $heroMeta['id'] . '_' . $heroDb['quality'] . '.gif'; + $info['image'] = 'https://res2.counterfire.games/nft/meta/' . $heroMeta['id'] . '_' . $heroDb['quality'] . '.gif'; $info['detail']['quality'] = $heroDb['quality']; $info['detail']['max_mining_days'] = $heroAtteMeta['validTime']; $info['detail']['wealth'] = floor($wealth * (1+$wealth_rate)); @@ -290,7 +290,7 @@ class OutAppNftController extends BaseController { $info['name'] = $itemMeta['name']; $info['item_id'] = $itemMeta['id']; $info['type'] = $nftDb['token_type']; - $info['image'] = 'https://res2.cebggame.com/nft/meta/' . $itemMeta['id'] . '.png'; + $info['image'] = 'https://res2.counterfire.games/nft/meta/' . $itemMeta['id'] . '.png'; $info['detail']['gold_coins'] = $this->getGoldBullionGoldNum($nftDb['item_id']); } } From 70a23fb4dcc89b8ba1318b522433b25ba48b5905 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 27 Jun 2024 11:00:44 +0800 Subject: [PATCH 6/6] 1 --- .../controller/OutAppNftController.class.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index e3ab0376..b876dadd 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -159,6 +159,9 @@ class OutAppNftController extends BaseController { "value" => intval($heroDb['hero_lv']), "max_value" => 15, )); + if ($this->isCloseBox()) { + $this->fillBoxMeta($info); + } } break; case Nft::GOLD_BULLION_TYPE: @@ -167,6 +170,9 @@ class OutAppNftController extends BaseController { //$info['name'] = $heroMeta['name']; $info['description'] = $NftMeta['desc']; $info['image'] = "https://res2.counterfire.games/nft/meta/".$nftDb['item_id'].".png"; + if ($this->isCloseBox()) { + $this->fillBoxMeta($info); + } } break; } @@ -280,6 +286,9 @@ class OutAppNftController extends BaseController { $info['detail']['crit'] = $heroAbility['critical']; } } + if ($this->isCloseBox()) { + $this->fillBoxDetail($info); + } } break; case Nft::GOLD_BULLION_TYPE: @@ -293,6 +302,9 @@ class OutAppNftController extends BaseController { $info['image'] = 'https://res2.counterfire.games/nft/meta/' . $itemMeta['id'] . '.png'; $info['detail']['gold_coins'] = $this->getGoldBullionGoldNum($nftDb['item_id']); } + if ($this->isCloseBox()) { + $this->fillBoxDetail($info); + } } break; } @@ -318,4 +330,39 @@ class OutAppNftController extends BaseController { } } + private function isCloseBox() + { + $openTime = 1719828000; + if (myself()->_getNowTime() < $openTime) { + if (SERVER_ENV == _ONLINE) { + return true; + } + } + return false; + } + + private function fillBoxMeta(&$info) + { + $info['name'] = 'box'; + $info['description'] = 'box'; + $info['image'] = "https://res2.counterfire.games/nft/box/Gen2_raw.gif"; + $info['attributes'] = array(); + } + + private function fillBoxDetail(&$info) + { + $info = array( + 'net_id' => $info['net_id'], + 'contract_address' => $info['contract_address'], + 'token_id' => $info['token_id'], + 'owner_address' => $info['owner_address'], + 'meta_url' => $info['meta_url'], + 'name' => 'box', + 'item_id' => 0, + 'type' => $info['type'], + 'image' => "https://res2.counterfire.games/nft/box/Gen2_raw.gif", + 'detail' => array() + ); + } + }