This commit is contained in:
songliang 2023-06-29 13:23:16 +08:00
parent 1200480a64
commit d7e8d22e2a

View File

@ -855,13 +855,13 @@ class ShopController extends BaseAuthedController
$count = $this->countFreeBuyTimes($row); $count = $this->countFreeBuyTimes($row);
if ($count < $row['free_num']) { if ($count < $row['free_num']) {
$isFreeBuy = true; $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; 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']) { if ($goods_num > $row['max_amount']) {
@ -1164,6 +1164,7 @@ class ShopController extends BaseAuthedController
$this->_rspErr(2, 'id is invalid'); $this->_rspErr(2, 'id is invalid');
return; return;
} }
$meta = mt\Item::get($shop['goods_id']);
$cost = $shop['price'] * $num; $cost = $shop['price'] * $num;
$isFreeBuy = false; $isFreeBuy = false;
if (!empty($shop['free_type'])) { if (!empty($shop['free_type'])) {
@ -1206,7 +1207,7 @@ class ShopController extends BaseAuthedController
array_push($result, $record[$key]); array_push($result, $record[$key]);
} }
if ($isFreeBuy) { if ($isFreeBuy) {
$this->addFreeBuyRecord($shop); $this->addFreeBuyRecord($shop);
} }
} }