From 6dc68804dec7b869d523de4a4724f5582ec7ef1f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 11 Jan 2022 11:40:01 +0800 Subject: [PATCH] 1 --- doc/Market.py | 48 ++++++++++++++++++++ doc/README.php | 3 +- doc/_common.py | 118 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 2 deletions(-) create mode 100644 doc/Market.py diff --git a/doc/Market.py b/doc/Market.py new file mode 100644 index 00000000..fa9526b7 --- /dev/null +++ b/doc/Market.py @@ -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(), '商品详细信息'], + ] + }, + ] diff --git a/doc/README.php b/doc/README.php index fd3fe3b7..15d07b4a 100644 --- a/doc/README.php +++ b/doc/README.php @@ -1,5 +1,5 @@ /** - * @api {GET} + * @api {GET} AA开发指南 AA开发指南 * @apiPermission none * @apiGroup AA开发指南 * @apiVersion 0.0.1 @@ -8,5 +8,4 @@ * * * - * */ diff --git a/doc/_common.py b/doc/_common.py index 7c400b47..91388422 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -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时间)'], + ]