This commit is contained in:
aozhiwei 2022-01-11 11:40:01 +08:00
parent c6b59f1961
commit 6dc68804de
3 changed files with 167 additions and 2 deletions

48
doc/Market.py Normal file
View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
import _common
class Market(object):
def __init__(self):
self.apis = [
{
'name': 'search',
'desc': '获取商店信息',
'group': 'Market',
'url': 'webapp/index.php?c=Market&a=search',
'params': [
['page', 0, '获取第几页数据'],
['type', 0, '0:英雄 1:枪支 2:芯片'],
['sort', '', '排序字段'],
],
'response': [
_common.RspHead(),
['!rows', [_common.Nft()], '商品信息'],
['page', _common.Page(), '分页信息'],
]
},
{
'name': 'buy',
'desc': '购买',
'group': 'Market',
'url': 'webapp/index.php?c=Market&a=buy',
'params': [
],
'response': [
_common.RspHead(),
]
},
{
'name': 'detail',
'desc': '获取商品详情',
'group': 'Market',
'url': 'webapp/index.php?c=Shop&a=detail',
'params': [
],
'response': [
_common.RspHead(),
# ['info', _common.NftDetail(), '商品详细信息'],
]
},
]

View File

@ -1,5 +1,5 @@
/**
* @api {GET}
* @api {GET} AA开发指南 AA开发指南
* @apiPermission none
* @apiGroup AA开发指南
* @apiVersion 0.0.1
@ -8,5 +8,4 @@
*
*
*
*
*/

View File

@ -16,6 +16,12 @@ class RspHead(object):
['errmsg', '', '错误描述'],
]
class Union(object):
def __init__(self, fields):
self.doc = 'Union 联合体的访问方式:.联合体内含结构的字段名'
self.fields = [['', f[0], f[1]] for f in fields]
class Attr(object):
def __init__(self):
@ -25,6 +31,27 @@ class Attr(object):
['val', 0, '属性值'],
]
class SystemCurrency(object):
def __init__(self):
self.fields = [
['type', 0, '类型'],
['name', '', '类型'],
['value', 0, ''],
['decimals', 0, ''],
]
class Page(object):
def __init__(self):
self.fields = [
['total', 0, '总记录数'],
['count', 0, '当前记录数'],
['per_page', 0, '每页多少条记录'],
['current_page', 0, '当前页'],
['total_pages', 0, '总页数'],
]
class Gun(object):
def __init__(self):
@ -368,3 +395,94 @@ class TeamInfo(object):
['state', 0, '0:未开始 1:准备就绪(这时客户端进入长链接走组队逻辑)'],
['!member_list', [TeamMember()], '队伍成员列表(包含自己)'],
]
class NftHero(object):
def __init__(self):
self.fields = [
]
class NftGun(object):
def __init__(self):
self.fields = [
]
class NftChip(object):
def __init__(self):
self.fields = [
]
class Nft(object):
def __init__(self):
self.fields = [
['nft_id', '', 'nft id'],
['type', 0, '类型 0:英雄 1:枪支 2:芯片'],
['token_id', '', '代币id?'],
['status', 0, '状态'],
['ref_id', '', '引用id?'],
['ref_type', 0, '引用类型?'],
['owner_address', '', '所有者地址'],
['owner_id', '', '所有者'],
['image_avatar', '', '图片'],
['image_full', '', '图片-全'],
['price', 0, '价格'],
['system_currency', SystemCurrency(), '系统货币'],
['info', Union([
[NftHero(), '英雄'],
[NftGun(), '枪支'],
[NftChip(), '芯片'],
]), 'nft信息'],
['created_at', 0, '创建时间(utc时间)'],
['last_modified_at', 0, '最后修改时间(utc时间)'],
]
class NftHeroDetail(object):
def __init__(self):
self.fields = [
]
class NftGunDetail(object):
def __init__(self):
self.fields = [
]
class NftChipDetail(object):
def __init__(self):
self.fields = [
]
class NftDetail(object):
def __init__(self):
self.fields = [
['nft_id', '', 'nft id'],
['type', 0, '类型 0:英雄 1:枪支 2:芯片'],
['token_id', '', '代币id?'],
['status', 0, '状态'],
['ref_id', '', '引用id?'],
['ref_type', 0, '引用类型?'],
['owner_address', '', '所有者地址'],
['owner_id', '', '所有者'],
['image_avatar', '', '图片'],
['image_full', '', '图片-全'],
['price', 0, '价格'],
['system_currency', [
['type', 0, '类型'],
['name', '', '类型'],
['value', 0, ''],
['decimals', 0, ''],
], '系统货币'],
# ['info', [
# ['info0', NftHeroDetail(), '英雄'],
# ['info1', NftGunDetail(), '枪支'],
# ['info2', NftChipDetail(), '芯片'],
# ], 'nft信息'],
['created_at', 0, '创建时间(utc时间)'],
['last_modified_at', 0, '最后修改时间(utc时间)'],
]