From e3e8e95072033a5d291e901e8b9a5a9191514267 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Nov 2022 10:19:08 +0800 Subject: [PATCH] 1 --- .../controller/BlockChainController.class.php | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 08909470..e044abf5 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -63,9 +63,24 @@ class BlockChainController extends BaseAuthedController { myself()->_rspErr(1, 'already activated'); return; } - if (!$heroDb['active_token_id']) { - + $tokenId = $heroDb['active_token_id']; + if (!$tokenId) { + $tokenId = BuyRecord::genOrderId + ( + 2006, + phpcommon\BC_FUNC_CREATION, + myself()->_getNowTime(), + myself()->_getOpenId() + ); + Hero::Update($heroDb['hero_uniid'], + array( + 'active_token_id' => $tokenId, + 'active_count' => function () { + return 'active_count + 1'; + } + )); } + $this->internalActivate721Nft($tokenId, Nft::HERO_TYPE, $heroDb['hero_uniid'], $heroDb['hero_id']); } break; case 2: @@ -136,4 +151,16 @@ class BlockChainController extends BaseAuthedController { } + private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId) + { + $params = array( + 'account_id' => myself()->_getAccountId(), + 'session_id' => myself()->_getSessionId(), + 'token_id' => $tokenId, + 'token_type' => $tokenType, + 'item_uniid' => $itemUniId, + 'item_id' => $itemId + ); + } + }