From d7e8d22e2ab6cc3afd6eefbffb474494e47c519f Mon Sep 17 00:00:00 2001 From: songliang Date: Thu, 29 Jun 2023 13:23:16 +0800 Subject: [PATCH] ... --- webapp/controller/ShopController.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 56338d4a..1fa09bd0 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -855,13 +855,13 @@ class ShopController extends BaseAuthedController $count = $this->countFreeBuyTimes($row); if ($count < $row['free_num']) { $isFreeBuy = true; - } else { - $this->_rspErr(1, "free_num parameter error, free_num: {$row['free_num']}"); + } + } + if (!$isFreeBuy) { + if (!in_array($token_type, $check_token_type)) { + $this->_rspErr(1, "token_type parameter error, desired_token_type: {$desired_token_type}"); return; } - } else if (!in_array($token_type, $check_token_type)) { - $this->_rspErr(1, "token_type parameter error, desired_token_type: {$desired_token_type}"); - return; } if ($goods_num > $row['max_amount']) { @@ -1164,6 +1164,7 @@ class ShopController extends BaseAuthedController $this->_rspErr(2, 'id is invalid'); return; } + $meta = mt\Item::get($shop['goods_id']); $cost = $shop['price'] * $num; $isFreeBuy = false; if (!empty($shop['free_type'])) { @@ -1206,7 +1207,7 @@ class ShopController extends BaseAuthedController array_push($result, $record[$key]); } if ($isFreeBuy) { - $this->addFreeBuyRecord($shop); + $this->addFreeBuyRecord($shop); } }