From 2307d68d6b20c3881945bf558090a1e741f405f1 Mon Sep 17 00:00:00 2001 From: azw Date: Sun, 30 Jul 2023 08:41:07 +0800 Subject: [PATCH] 1 --- webapp/controller/ShopController.class.php | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 8f5025fc..d69b551f 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -114,9 +114,6 @@ class ShopController extends BaseAuthedController { } } - // 这里命名混乱了, 购买个数,一捆个数命名冲突 - $goods_count = $goodsMeta['goods_num']; - $price_array = splitStr1($goodsMeta['price']); $discount_array = splitStr1($goodsMeta['discount']); @@ -133,20 +130,15 @@ class ShopController extends BaseAuthedController { $costItemId = $this->getCostItemIdByTokenType($tokenType); $costItems = $this->makeCostItems($costItemId, $goodsNum * $need_price); - switch ($tokenType) { - case ShopController::TOKEN_TYPE_GOLD: - { - } - break; - case ShopController::TOKEN_TYPE_DIAMOND: - { - } - break; - default: - { + if (!in_array( + $tokenType, + array( + mt\Shop::TOKEN_TYPE_GOLD, + mt\Shop::TOKEN_TYPE_DIAMOND + ) + )) { $this->_rspErr(1, "token_type is unsupport, {$tokenType}"); - } - break; + return; } $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) {