86 lines
3.3 KiB
Python
86 lines
3.3 KiB
Python
# -*- coding: utf-8 -*-
|
||
|
||
import _common
|
||
|
||
class Market(object):
|
||
|
||
def __init__(self):
|
||
self.apis = [
|
||
{
|
||
'name': 'searchBox',
|
||
'desc': '获取预售商品信息',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=searchBox',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['page', 0, '获取第几页数据'],
|
||
['sort', '', '排序字段'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['!rows', [_common.PreSaleBox()], '商品信息'],
|
||
['page', _common.Page(), '分页信息'],
|
||
['presale_info', _common.PreSaleInfo(), '预售信息'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'buyBox',
|
||
'desc': '购买箱子',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=buyBox',
|
||
'params': [
|
||
['type', '', '注意是箱子id!!!(box_id)'],
|
||
['buyer_address', '', '购买者账号id'],
|
||
['price', '', 'price'],
|
||
['payment_token_address', '', 'payment_token_address'],
|
||
['nonce', '', 'nonce'],
|
||
['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['order_id', '', '订单号(errcode = 0的时候,根据订单号客户端定时调用queryOrder接口)查询状态'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'queryOrder',
|
||
'desc': '查询订单状态',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=queryOrder',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['order_id', 0, '订单id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(errcode='当errcode!=0的时候客户端不需要再调用(停止定时器)'),
|
||
['state', 0, '0:订单不存在 1:购买成功 2:交易处理中 3:交易失败'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'getNftList',
|
||
'desc': '获取账号对应的nft列表',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=getNftList',
|
||
'params': [
|
||
['account', '', '账号id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['!nfts', [_common.NftDetail()], 'nft列表'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'getNftDetail',
|
||
'desc': '获取商品详情',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=getNftDetail',
|
||
'params': [
|
||
['account', '', '账号id'],
|
||
['token_id', '', 'token_id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['info', _common.NftDetail(), '商品详细信息'],
|
||
]
|
||
},
|
||
]
|