diff --git a/doc/_common.py b/doc/_common.py index e4fd236..bbdc006 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -108,9 +108,9 @@ class CostInfoItem(object): def __init__(self): self.fields = [ - ['cost_item_id', 0, '购买需要消耗的道具id'], - ['cost_item_num', 0, '购买需要消耗的道具数量'], - ['cost_item_is_discount', 0, '是否参与折扣'], + ['item_id', 0, '购买需要消耗的道具id'], + ['item_num', 0, '购买需要消耗的道具数量'], + ['is_discount', 0, '是否参与折扣'], ] class CostInfo(object): diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 7d0ec37..8ef0dcd 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -76,7 +76,7 @@ class ShopController extends BaseAuthedController { { $itemId = getReqVal('item_id', 0); $itemNum = getReqVal('item_num', 0); - $costItemId = getReqVal('cost_item_id', 0); + $costItemId = getReqVal('item_id', 0); $itemMeta = mt\Item::get($itemId); if (!$itemMeta) { @@ -89,14 +89,14 @@ class ShopController extends BaseAuthedController { } $costItemMeta = mt\Item::get($costItemId); if (!$costItemMeta) { - $this->_rspErr(1, 'cost_item_id参数错误'); + $this->_rspErr(1, 'item_id参数错误'); return; } $types = array(mt\Item::HERO_TYPE, mt\Item::HERO_SKIN_TYPE, mt\Item::GUN_SKIN_TYPE); if (!mt\Item::inTypes($itemMeta, $types)) { - $this->_rspErr(1, 'cost_item_id参数错误'); + $this->_rspErr(1, 'item_id参数错误'); return; } { @@ -130,7 +130,7 @@ class ShopController extends BaseAuthedController { break; default: { - $this->_rspErr(1, 'cost_item_id参数错误'); + $this->_rspErr(1, 'item_id参数错误'); return; } break; @@ -193,7 +193,7 @@ class ShopController extends BaseAuthedController { if ($costGroup) { return; } - if (count($val) > 0 && $val[0]['cost_item_id'] == $costItemId) { + if (count($val) > 0 && $val[0]['item_id'] == $costItemId) { $costGroup = $val; return; } @@ -203,19 +203,19 @@ class ShopController extends BaseAuthedController { } $costItems = array(); array_walk($costGroup, function ($val) use (&$costItems, $priceInfo) { - if ($val['cost_item_is_discount'] && + if ($val['is_discount'] && $priceInfo['discount'] > 0 && $this->_getNowTime() >= $priceInfo['discount_begin_time'] && $this->_getNowTime() <= $priceInfo['discount_end_time'] ) { array_push($costItems, array( - 'item_id' => $val['cost_item_id'], - 'item_num' => (int)($val['cost_item_num'] * ($priceInfo['discount'] / 100)), + 'item_id' => $val['item_id'], + 'item_num' => (int)($val['item_num'] * ($priceInfo['discount'] / 100)), )); } else { array_push($costItems, array( - 'item_id' => $val['cost_item_id'], - 'item_num' => $val['cost_item_num'], + 'item_id' => $val['item_id'], + 'item_num' => $val['item_num'], )); } }); diff --git a/webapp/mt/Item.php b/webapp/mt/Item.php index 7e1e28f..1f24ee8 100644 --- a/webapp/mt/Item.php +++ b/webapp/mt/Item.php @@ -91,17 +91,17 @@ class Item { if ($meta['gold'] > 0) { array_push($info['price_info']['cost_list'], array( - 'cost_item_id' => V_ITEM_GOLD, - 'cost_item_num' => $meta['gold'], - 'cost_item_is_discount' => 1 + 'item_id' => V_ITEM_GOLD, + 'item_num' => $meta['gold'], + 'is_discount' => 1 )); } if ($meta['diamond_price'] > 0) { array_push($info['price_info']['cost_list'], array( - 'cost_item_id' => V_ITEM_DIAMOND, - 'cost_item_num' => $meta['diamond_price'], - 'cost_item_is_discount' => 1 + 'item_id' => V_ITEM_DIAMOND, + 'item_num' => $meta['diamond_price'], + 'is_discount' => 1 )); } return $info;