This commit is contained in:
aozhiwei 2023-07-31 16:23:07 +08:00
parent a97a35f514
commit f69a0d7351

View File

@ -102,11 +102,6 @@ class ShopController extends BaseAuthedController {
}
$propertyChgService = new services\PropertyChgService();
$awardService = new services\AwardService();
$costItemId = myself()->getCostItemIdByTokenType($tokenType);
$costItems = array(
'item_id' => $costItemId,
'item_num' => $goodsNum * $needPrice
);
$tokenType = $goodsMeta['token_type'];
$price = $goodsMeta['price'];
if (!in_array(
@ -119,6 +114,15 @@ class ShopController extends BaseAuthedController {
myself()->_rspErr(1, "token_type is unsupport, {$tokenType}");
return;
}
if ($price < 1) {
myself()->_rspErr(1, "config error");
return;
}
$costItemId = myself()->getCostItemIdByTokenType($tokenType);
$costItems = array(
'item_id' => $costItemId,
'item_num' => $goodsNum * $price
);
$lackItem = null;
if (!myself()->_hasEnoughItems($costItems, $lackItem)) {
myself()->_rspErr(2, myself()->_getLackItemErrMsg($lackItem));