diff --git a/doc/BlockChain.py b/doc/BlockChain.py index e525d7f6..2bc82646 100644 --- a/doc/BlockChain.py +++ b/doc/BlockChain.py @@ -7,30 +7,169 @@ class BlockChain(object): def __init__(self): self.apis = [ { - 'name': 'activeNft', - 'desc': '激活nft', + 'name': 'getTransactionList', + 'desc': '获取列交易列表', 'group': 'BlockChain', - 'url': 'webapp/index.php?c=ActiveNft&a=activeNft', + 'url': 'webapp/index.php?c=BlockChain&a=getTransactionList', + 'params': [ + ], + 'response': [ + _common.RspHead(), + ['!transactions', [_common.NftTransaction()], '交易列表'] + ] + }, + { + 'name': 'active721Nft', + 'desc': '激活721nft', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=active721Nft', 'params': [ ['type', 0, '1:英雄 2:枪械'], ['uniid', 0, '唯一id'], ], 'response': [ _common.RspHead(), + ['trans_id', '', '事务id'], + ['!params', [''], '合约参数列表'], + ] + }, + { + 'name': 'active1155Nft', + 'desc': '激活721nft', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=active1155Nft', + 'params': [ + ['trans_id', '', '事务id'], + ], + 'response': [ + _common.RspHead(), + ['trans_id', '', '事务id'], + ['!params', [''], '合约参数列表'], ] }, { 'name': 'reportActiveResult', 'desc': '上报激活结果', 'group': 'BlockChain', - 'url': 'webapp/index.php?c=ActiveNft&a=reportActiveResult', + 'url': 'webapp/index.php?c=BlockChain&a=reportActiveResult', 'params': [ - ['type', 0, '1:英雄 2:枪械'], - ['uniid', 0, '唯一id'], + ['trans_id', '', '事务id'], + ['result', '', '合约返回值'], + ], + 'response': [ + _common.RspHead(), + ] + }, + { + 'name': 'evolve721Nft', + 'desc': 'nft进阶(英雄,武器)', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=evolve721Nft', + 'params': [ + ['type', 0, '1:英雄 2:枪械'], + ['token_id1', 0, 'tokenid1'], + ['token_id2', 0, 'tokenid2'], + ], + 'response': [ + _common.RspHead(), + ['trans_id', '', '事务id'], + ['!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': '芯片进阶', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=evolveChip', + 'params': [ + ['token_id1', 0, 'tokenid1'], + ['token_ids', '', 'tokenids材料id(|分割)'], + ], + 'response': [ + _common.RspHead(), + ['trans_id', '', '事务id'], + ['!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': '碎片生成', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=mintShardBatchUser', + 'params': [ + ['ids', 0, 'tokenid1'], + ], + 'response': [ + _common.RspHead(), + ['trans_id', '', '事务id'], + ['!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': '碎片合成', + 'group': 'BlockChain', + 'url': 'webapp/index.php?c=BlockChain&a=shardMixByUser', + 'params': [ + ['token_id1', 0, 'tokenid1'], + ['token_id2', 0, 'tokenid2'], + ], + 'response': [ + _common.RspHead(), + ['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/doc/Shop.py b/doc/Shop.py index df8e3300..c197434d 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -52,4 +52,17 @@ class Shop(object): ['!goods_list', [_common.DiscountInfo()], '折扣的商品列表'], ] }, + { + 'name': 'getStageList', + 'desc': '获取指定层级的商店id列表', + 'group': 'Shop', + 'url': 'webapp/index.php?c=Shop&a=getStageList', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!shop_id_list', [0], '1:Recommend 2:Hero 3:Weapon 4:Chip 5:Consume'] + ] + } ] diff --git a/doc/_common.py b/doc/_common.py index c0dd6025..9e2748ea 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -926,3 +926,13 @@ class BattleHistory(object): ['pve_instance_id', 0, 'pve副本难度id'], ['pve_instance_mode', 0, 'pve副本mode'], ] + +class NftTransaction(object): + + def __init__(self): + self.fields = [ + ['item_id', 0, '道具id'], + ['action', 0, '动作'], + ['time', 0, '时间'], + ['status', 0, '1:已完成 2:等待中'], + ] diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 2dcd8e59..8a057616 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -777,3 +777,23 @@ CREATE TABLE `t_parachute` ( PRIMARY KEY (`idx`) ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_transaction` +-- + +DROP TABLE IF EXISTS `t_transaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_transaction` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)', + `trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id', + `action` int(11) NOT NULL DEFAULT '0' COMMENT 'action', + `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', + `status` int(11) NOT NULL DEFAULT '0' COMMENT 'status', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php new file mode 100644 index 00000000..c2dcc930 --- /dev/null +++ b/webapp/controller/BlockChainController.class.php @@ -0,0 +1,86 @@ +