From ac5932afe60e91ab69d16b7a24037bc1a8f67835 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Nov 2022 12:10:14 +0800 Subject: [PATCH] 1 --- doc/BlockChain.py | 80 ++++--------------- .../controller/BlockChainController.class.php | 27 ++----- webapp/models/Transaction.php | 15 ++++ 3 files changed, 34 insertions(+), 88 deletions(-) diff --git a/doc/BlockChain.py b/doc/BlockChain.py index 4e875a39..cfa4ad37 100644 --- a/doc/BlockChain.py +++ b/doc/BlockChain.py @@ -18,6 +18,19 @@ class BlockChain(object): ['!transactions', [_common.NftTransaction()], '交易列表'] ] }, + { + 'name': 'reportResult', + 'desc': '上报链调用结果', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=reportResult', + 'params': [ + ['trans_id', '', '事务id'], + ['result', '', '合约返回值'], + ], + 'response': [ + _common.RspHead(), + ] + }, { 'name': 'active721Nft', 'desc': '激活721nft', @@ -47,19 +60,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportActiveResult', - 'desc': '上报激活结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportActiveResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'evolve721Nft', 'desc': 'nft进阶(英雄,武器)', @@ -76,19 +76,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportEvolve721NftResult', - 'desc': '上报nft进阶(英雄、武器)结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportEvolve721NftResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'evolveChip', 'desc': '芯片进阶', @@ -104,19 +91,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportEvolveChipResult', - 'desc': '上报芯片进阶结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportEvolveChipResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'mintShardBatchUser', 'desc': '碎片生成', @@ -131,19 +105,6 @@ class BlockChain(object): ['!params', [''], '合约参数列表'], ] }, - { - 'name': 'reportMintShardBatchUserResult', - 'desc': '上报碎片生成结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportMintShardBatchUserResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'shardMixByUser', 'desc': '碎片合成', @@ -158,18 +119,5 @@ class BlockChain(object): ['trans_id', '', '事务id'], ['!params', [''], '合约参数列表'], ] - }, - { - 'name': 'reportShardMixByUserUserResult', - 'desc': '上报碎片合成结果', - 'group': 'BlockChain', - 'url': 'webapp/index.php?c=BlockChain&a=reportShardMixByUserResult', - 'params': [ - ['trans_id', '', '事务id'], - ['result', '', '合约返回值'], - ], - 'response': [ - _common.RspHead(), - ] - }, + } ] diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 8d7bd8c7..10ffb5d3 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -106,9 +106,12 @@ class BlockChainController extends BaseAuthedController { } - public function reportActiveResult() + public function reportResult() { - + $transId = getReqVal('trans_id', ''); + $result = getReqVal('result', ''); + Transaction::reportResult($transId, $result); + myself()->_rspOk(); } public function evolve721Nft() @@ -116,41 +119,21 @@ class BlockChainController extends BaseAuthedController { } - public function reportEvolve721NftResult() - { - - } - public function evolveChip() { } - public function reportEvolveChipResult() - { - - } - public function mintShardBatchUser() { } - public function reportMintShardBatchUserResult() - { - - } - public function shardMixByUser() { } - public function reportShardMixByUserResult() - { - - } - private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId) { $params = array( diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index 453b2b5b..d961c031 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -120,4 +120,19 @@ class Transaction extends BaseModel { } } + public static function reportResult($transId, $result) + { + SqlHelper::update( + myself()->_getSelfMysql(), + 't_transaction', + array( + 'account_id' => myself()->_getAccountId(), + 'trans_id' => $transId + ), + array( + 'client_result' => $result + ) + ); + } + }