diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 6d3ccb7b..2b94b5a8 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -103,7 +103,28 @@ class BlockChainController extends BaseAuthedController { myself()->_rspErr(1, 'gun not found'); return; } - + if ($gunDb['token_id']) { + myself()->_rspErr(1, 'already activated'); + return; + } + $tokenId = $gunDb['active_token_id']; + if (!$tokenId) { + $tokenId = BuyRecord::genOrderId + ( + 2006, + phpcommon\BC_FUNC_CREATION, + myself()->_getNowTime(), + myself()->_getOpenId() + ); + Gun::Update($gunDb['gun_uniid'], + array( + 'active_token_id' => $tokenId, + 'active_count' => function () { + return 'active_count + 1'; + } + )); + } + $this->internalActivate721Nft($tokenId, Nft::GUN_TYPE, $gunDb['gun_uniid'], $gunDb['gun_id']); } break; default: