From 915aa9f721abc7d106e6054f598f6f336ed18f2b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 27 Jul 2023 15:28:36 +0800 Subject: [PATCH] 1 --- doc/Shop.py | 10 +++---- doc/_common.py | 35 ++++++++++++++++++---- webapp/controller/ShopController.class.php | 3 +- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/doc/Shop.py b/doc/Shop.py index 94930427..fdade734 100644 --- a/doc/Shop.py +++ b/doc/Shop.py @@ -17,14 +17,14 @@ class Shop(object): ], 'response': [ _common.RspHead(), - ['!goods_list', [_common.NewGoods()], '商品列表'], + ['!goods_list', [_common.Goods()], '商品列表'], ] }, { - 'name': 'buyGoodsNormal', - 'desc': '购买商品(正式)', + 'name': 'buyGoods', + 'desc': '购买商品', 'group': 'Shop', - 'url': 'webapp/index.php?c=Shop&a=buyGoodsNormal', + 'url': 'webapp/index.php?c=Shop&a=buyGoods', 'params': [ _common.ReqHead(), ['id', 0, '商品唯一id,参见shopGoods表'], @@ -36,7 +36,7 @@ class Shop(object): ['block_chain', _common.ShopTrans(), '链上购买订单信息'], ['award', _common.Award(), '奖励信息'], ['property_chg', _common.PropertyChg(), '属性变更'], - ['goods_chg', _common.NewGoods(), '购买后更新商品的最新信息(可能为null客户端需要做容错处理)'], + ['goods_chg', _common.Goods(), '购买后更新商品的最新信息(可能为null客户端需要做容错处理)'], ] }, { diff --git a/doc/_common.py b/doc/_common.py index 6481e640..976212d1 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -151,6 +151,7 @@ class UserInfo(object): ['!ring_list', [0], '勋章(戒指)列表'], ['!honor_info', [HonorInfo()], '荣誉信息'], ] + class HonorInfo(object): def __init__(self): @@ -158,6 +159,7 @@ class HonorInfo(object): ['token_type',0,'NFT 类型'], ['state',0,'1使用 0未使用'], ] + class UserSimple(object): def __init__(self): @@ -376,17 +378,38 @@ class ItemPriceInfo(object): ['price_info', PriceInfo(), '价格信息'], ] +class GoodsInfo(object): + + def __init__(self): + self.fields = [ + ['id', 0, '商品唯一id'], + ['goods_id', 0, '商品id'], + ['goods_num', 0, '堆叠个数,例如:砖石数量'], + ['max_amount', 0, '最高购买数量,单次购买'], + ['shop_id', 0, '所属商店id'], + ['shopstage', 0, '商店层级'], + ['tag', 0, '标签'], + ['recommend', 0, '推荐页位置'], + ['token_type', '', '代币类型 参见shopGoods表格'], + ['price', '', '价格 多种价格设置使用 | 隔开'], + ['discount', '', '折扣 参见shopGoods表格'], + ['limit_type', 0, '限购类型'], + ['limit_num', 0, '限购数量'], + ['buy_cond', '', '购买条件'], + ['buy_gift', '', '购买次数赠品'], + ['normal_gift', '', '普通狗赠品'], + ['free_type', 0, '免费类型 0:不免费 1:日刷新'], + ['free_num', 0, '免费次数'], + ['pending', 0, '购买中...'], + ] + class Goods(object): def __init__(self): self.fields = [ - ['goods_id', 0, '商品id 用于购买的时候回传'], - ['item_id', 0, '配置表id'], - ['price_info', PriceInfo(), '价格信息'], - ['flag_icon', '', '商品标记(商品左上角的显示图标,超值、9折等)'], - ['limit_type', 0, '0:不限购(这时忽略bought_times、total_buy_times) 1:每日限购 2:周限购 3:累计限购'], + ['!goods_meta', GoodsInfo(), '商品元信息(配置表数据)'], ['bought_times', 0, '已购买次数'], - ['total_buy_times', 0, '总的可购买次数'], + ['free_num', 0, '免费次数'], ] class NewGoods(object): diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 60250e73..b0aa2b75 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -83,7 +83,6 @@ class ShopController extends BaseAuthedController //27 = 韩国 const TOKEN_TYPE_KRW = '27'; - // 限购类型 const DAILY_BUY_LIMIT = 1; const WEEKLY_BUY_LIMIT = 2; @@ -350,7 +349,7 @@ class ShopController extends BaseAuthedController ); } - public function buyGoodsNormal() + public function buyGoods() { $address = $this->_getAddress(); if (empty($address)) {