This commit is contained in:
aozhiwei 2024-06-17 17:40:59 +08:00
parent ca59bdccd1
commit f1a575e9f0

View File

@ -124,40 +124,36 @@ class BlockChainController extends BaseAuthedController {
myself()->_rspErr(1, 'hero not found'); myself()->_rspErr(1, 'hero not found');
return; return;
} }
$isMint = true;
if ($heroDb['token_id'] && $heroDb['activate']) { if ($heroDb['token_id'] && $heroDb['activate']) {
myself()->_rspErr(1, 'already activated'); $isMint = false;
return; } else {
} $tokenId = $heroDb['token_id'];
/* if (!$tokenId) {
if ($heroDb['state'] == 1) { $tokenId = BuyRecord::genOrderId
myself()->_rspErr(1, 'cant mint'); (
return; GAME_ID,
}*/ phpcommon\BC_FUNC_CREATION,
$tokenId = $heroDb['token_id']; myself()->_getNowTime(),
if (!$tokenId) { myself()->_getAddress()
$tokenId = BuyRecord::genOrderId );
( Hero::safeUpdateTokenId($heroDb['hero_uniid'], $tokenId);
GAME_ID, $heroDb = Hero::find($uniid);
phpcommon\BC_FUNC_CREATION, if (!$heroDb) {
myself()->_getNowTime(), myself()->_rspErr(1, 'hero not found');
myself()->_getAddress() return;
); }
Hero::safeUpdateTokenId($heroDb['hero_uniid'], $tokenId); if ($heroDb['token_id'] != $tokenId) {
$heroDb = Hero::find($uniid); myself()->_rspErr(500, 'server internal error');
if (!$heroDb) { return;
myself()->_rspErr(1, 'hero not found'); }
return;
}
if ($heroDb['token_id'] != $tokenId) {
myself()->_rspErr(500, 'server internal error');
return;
} }
} }
$this->internalActivate721Nft($tokenId, $this->internalActivate721Nft($tokenId,
Nft::HERO_TYPE, Nft::HERO_TYPE,
$heroDb['hero_uniid'], $heroDb['hero_uniid'],
$heroDb['hero_id'], $heroDb['hero_id'],
true); $isMint);
} }
break; break;
default: default:
@ -204,7 +200,7 @@ class BlockChainController extends BaseAuthedController {
'token_type' => $tokenType, 'token_type' => $tokenType,
'item_uniid' => $itemUniId, 'item_uniid' => $itemUniId,
'item_id' => $itemId, 'item_id' => $itemId,
'is_mint' => $isMint, 'is_mint' => $isMint ? 1 : 0,
'net_id' => NET_ID 'net_id' => NET_ID
); );
{ {