diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index e7ecad32..002002dc 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -179,6 +179,37 @@ class BlockChainController extends BaseAuthedController { $this->internalActivate721Nft($tokenId, Nft::EQUIP_TYPE, $gunDb['gun_uniid'], $gunDb['gun_id']); } break; + case 3: + { + $chipDb = Chip::find($uniid); + if (!$chipDb) { + myself()->_rspErr(1, 'chip not found'); + return; + } + if ($chipDb['token_id']) { + myself()->_rspErr(1, 'already activated'); + return; + } + $tokenId = $chipDb['active_token_id']; + if (!$tokenId) { + $tokenId = BuyRecord::genOrderId + ( + 2006, + phpcommon\BC_FUNC_CREATION, + myself()->_getNowTime(), + myself()->_getOpenId() + ); + Chip::Update($chipDb['chip_uniid'], + array( + 'active_token_id' => $tokenId, + 'active_count' => function () { + return 'active_count + 1'; + } + )); + } + $this->internalActivate721Nft($tokenId, Nft::CHIP_TYPE, $chipDb['chip_uniid'], $chipDb['item_id']); + } + break; default: { myself()->_rspErr(1, 'type param error');