From e6a6b90fa5eeeeb09d516e3d5a2616e3c148a4c0 Mon Sep 17 00:00:00 2001 From: azw Date: Sat, 29 Jul 2023 19:12:40 +0800 Subject: [PATCH] 1 --- webapp/controller/ShopController.class.php | 8 ++++++-- webapp/services/ShopService.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index ddc74396..a915164b 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -84,14 +84,18 @@ class ShopController extends BaseAuthedController { $this->_rspErr(1, 'goods not found, goods_id: ' . $goodsMeta['goods_id']); return; } + $errCode = 0; + $errMsg = ''; if ($itemMeta['type'] == mt\Item::HERO_SKIN_TYPE) { - $errCode = 0; - $errMsg = ''; if (!$this->canBuy($itemMeta, $errCode, $errMsg)) { $this->_rspErr($errCode, $errMsg); return; } } + if (!ShopService::buyLimitCheck($goodsMeta, $errCode, $errMsg)) { + $this->_rspErr($errCode, $errMsg); + return; + } $goodsId = $goodsMeta['goods_id']; diff --git a/webapp/services/ShopService.php b/webapp/services/ShopService.php index dafb4c37..5a7624e2 100644 --- a/webapp/services/ShopService.php +++ b/webapp/services/ShopService.php @@ -102,8 +102,10 @@ class ShopService { return 0; } - public static function buyLimitCheck($goodsMeta) + public static function buyLimitCheck($goodsMeta, &$errCode, &$errMsg) { + $errCode = 0; + $errMsg = ''; $buyRecordHash = ShopBuyRecord::allToHash(); $boughtTimes = 1; {