From ce97612a7f2b47c3de38960f941f588d153ad838 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 3 Nov 2022 17:03:02 +0800 Subject: [PATCH] 1 --- .../controller/BlockChainController.class.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 059fb2a3..7209290b 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -30,7 +30,8 @@ class BlockChainController extends BaseAuthedController { public function _handlePre() { parent::_handlePre(); - if (getReqVal('a') != 'getTransactionList') { + if (getReqVal('a', '') != 'getTransactionList' && + myself()->_getChannel() != BC_CHANNEL) { die(json_encode(array( 'errcode' => 501, 'errmsg' => 'you are not a wallet user' @@ -148,12 +149,12 @@ class BlockChainController extends BaseAuthedController { switch ($itemMeta['type']) { case mt\Item::FRAGMENT_BOX_TYPE: { - $this->internalOpenChipBox($itemDb, $num); + $this->internalOpenFragmentBox($itemDb, $num); } break; case mt\Item::CHIP_BOX_TYPE: { - $this->internalOpenFragmentBox($itemDb, $num); + $this->internalOpenChipBox($itemDb, $num); } break; default: @@ -248,12 +249,13 @@ class BlockChainController extends BaseAuthedController { return; } error_log($response); + $tokenType = Nft::CHIP_TYPE; $rspObj = json_decode($response, true); if ($rspObj['errcode'] == 0) { $transId = $rspObj['trans_id']; Transaction::add( $transId, - Transaction::MINT_721_ACTION_TYPE, + Transaction::MINT_1155_ACTION_TYPE, $tokenId, $tokenType, $itemUniId, @@ -271,15 +273,16 @@ class BlockChainController extends BaseAuthedController { } private function internalOpenFragmentBox($itemDb, $num) { + $tokenId = $itemDb['item_id']; $params = array( 'c' => 'BcService', 'a' => 'mintShardBatchUser', 'account_id' => myself()->_getAccountId(), 'session_id' => myself()->_getSessionId(), 'account' => myself()->_getOpenId(), - 'token_id' => $itemDb['item_id'], - 'item_uniid' => $itemUniId, - 'item_id' => $itemId, + 'token_id' => $tokenId, + 'item_uniid' => $itemDb['item_uniid'], + 'item_id' => $itemDb['item_id'], 'num' => $num ); { @@ -294,16 +297,17 @@ class BlockChainController extends BaseAuthedController { return; } error_log($response); + $tokenType = Nft::FRAGMENT_TYPE; $rspObj = json_decode($response, true); if ($rspObj['errcode'] == 0) { $transId = $rspObj['trans_id']; Transaction::add( $transId, - Transaction::MINT_721_ACTION_TYPE, + Transaction::MINT_SHARD_BATCH_ACTION_TYPE, $tokenId, $tokenType, - $itemUniId, - $itemId + $itemDb['item_uniid'], + $itemDb['item_id'] ); myself()->_rspData(array( 'trans_id' => $transId,