This commit is contained in:
aozhiwei 2021-12-01 10:39:13 +08:00
parent 9838fb8d7b
commit bc71f81cbd
3 changed files with 30 additions and 6 deletions

View File

@ -29,12 +29,27 @@ class Shop(object):
_common.ReqHead(),
['shop_id', 0, '商店id shop_id=100特殊商店id'],
['goods_id', 0, '商品id'],
['goods_num', 0, '商品数量'],
['cost_item_id', 0, '支付方式'],
],
'response': [
_common.RspHead(),
['award', _common.Award(), '奖励信息'],
['property_chg', _common.PropertyChg(), '属性变更'],
['goods_chg', _common.Goods(), '购买后更新商品的最新信息'],
]
},
{
'name': 'getDiscountList',
'desc': '获取商品折扣列表',
'group': 'Shop',
'url': 'webapp/index.php?c=Shop&a=getDiscountList',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
['!goods_list', [_common.DiscountInfo()], '折扣的商品列表'],
]
},
]

View File

@ -130,6 +130,14 @@ class PriceInfo(object):
['discount_end_time', 0, '折扣结束时间(utc时间)'],
]
class DiscountInfo(object):
def __init__(self):
self.fields = [
['item_id', 0, '购买需要消耗的道具id'],
['discount', 0, '折扣百分比0-100'],
]
class ItemPriceInfo(object):
def __init__(self):

View File

@ -97,8 +97,13 @@ class ShopController extends BaseAuthedController {
$goodsId = getReqVal('goods_id', 0);
$itemNum = getReqVal('goods_num', 0);
$costItemId = getReqVal('cost_item_id', 0);
$itemId = $goodsId;
if ($shopId == mt\Shop::OUTSIDE_SHOP) {
$this->outsideBuy($shopId, $itemId, $itemNum, $costItemId);
return;
}
$itemMeta = mt\Item::get($itemId);
if (!$itemMeta) {
$this->_rspErr(1, 'goods_id参数错误');
@ -191,12 +196,8 @@ class ShopController extends BaseAuthedController {
));
}
private function outsideBuy()
private function outsideBuy($shopId, $itemId, $itemNum, $costItemId)
{
$itemId = getReqVal('item_id', 0);
$itemNum = getReqVal('item_num', 0);
$costItemId = getReqVal('cost_item_id', 0);
$itemMeta = mt\Item::get($itemId);
if (!$itemMeta) {
$this->_rspErr(1, 'item_id参数错误');