From 5888f6d675a10bfa9ddb13e401da4f7e2462aa6c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 4 Nov 2022 14:13:49 +0800 Subject: [PATCH] 1 --- webapp/controller/BlockChainController.class.php | 10 ++++++++-- webapp/models/Chip.php | 7 +++++++ webapp/models/Nft.php | 13 +++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index cb4df0ca..aae8ac0d 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -205,6 +205,12 @@ class BlockChainController extends BaseAuthedController { return; } + $nftDb = Chip::findByTokenId($tokenId1); + if (!$nftDb) { + myself()->_rspErr(1, 'token_id1 paramater error'); + return; + } + $this->internalBcCall( array( 'c' => 'BcService', @@ -219,8 +225,8 @@ class BlockChainController extends BaseAuthedController { 'action' => Transaction::EVOLVE_CHIP_ACTION_TYPE, 'tokenId' => $tokenId1, 'itemType' => 0, - 'itemUniId' => 0, - 'itemId' => 0 + 'itemUniId' => $nftDb['chip_uniid'], + 'itemId' => $nftDb['item_id'] ) ); } diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index 10d7a722..859feb49 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -37,6 +37,13 @@ class Chip extends BaseModel 'token_id' => $tokenId ) ); + if ($row) { + $row['chip_uniid'] = $row['idx']; + if (NftService::getChipBlance(myself()->_getOpenId(), $tokenId) <= 0) { + $row = null; + } + } + return $row; } public static function getChipList($cb) diff --git a/webapp/models/Nft.php b/webapp/models/Nft.php index 713fdfc0..06305d47 100644 --- a/webapp/models/Nft.php +++ b/webapp/models/Nft.php @@ -87,6 +87,19 @@ class Nft extends BaseModel { return $nftList; } + public static function getChipBlance($account, $tokenId) + { + $row = SqlHelper::ormSelectOne( + myself()->_getMarketMysql(), + 't_nft1155', + array( + 'owner_address' => $account, + 'token_id' => $tokenId, + ) + ); + return $row ? $row['balance'] : 0; + } + public static function getNftListByType($account, $type) { $nftList = array();