From 2350c4e633a8d5b4ea39522890ba72c4309b42b1 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 19 Jun 2024 16:17:46 +0800 Subject: [PATCH] 1 --- .../controller/BlockChainController.class.php | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index b2aedd46..0d850ffd 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -130,28 +130,26 @@ class BlockChainController extends BaseAuthedController { return; } $isMint = true; + $tokenId = $heroDb['token_id']; if ($heroDb['token_id'] && $heroDb['activate']) { $isMint = false; - } else { - $tokenId = $heroDb['token_id']; - if (!$tokenId) { - $tokenId = BuyRecord::genOrderId - ( - GAME_ID, - phpcommon\BC_FUNC_CREATION, - myself()->_getNowTime(), - myself()->_getAddress() - ); - Hero::safeUpdateTokenId($heroDb['hero_uniid'], $tokenId); - $heroDb = Hero::find($uniid); - if (!$heroDb) { - myself()->_rspErr(1, 'hero not found'); - return; - } - if ($heroDb['token_id'] != $tokenId) { - myself()->_rspErr(500, 'server internal error'); - return; - } + } else if (empty($tokenId) ){ + $tokenId = BuyRecord::genOrderId + ( + GAME_ID, + phpcommon\BC_FUNC_CREATION, + myself()->_getNowTime(), + myself()->_getAddress() + ); + Hero::safeUpdateTokenId($heroDb['hero_uniid'], $tokenId); + $heroDb = Hero::find($uniid); + if (!$heroDb) { + myself()->_rspErr(1, 'hero not found'); + return; + } + if ($heroDb['token_id'] != $tokenId) { + myself()->_rspErr(500, 'server internal error'); + return; } } $this->internalActivate721Nft($tokenId, @@ -277,6 +275,7 @@ class BlockChainController extends BaseAuthedController { 'is_mint' => $isMint ? 1 : 0, 'net_id' => NET_ID ); + error_log(json_encode($params)); { $url = self::getWeb3ServiceUrl(); $response = '';