This commit is contained in:
azw 2023-07-29 09:21:01 +08:00
parent 98c38f44e3
commit 59c18b3544

View File

@ -71,11 +71,19 @@ class ShopController extends BaseAuthedController {
}
$goodsMeta = mt\ShopGoods::get($id);
if (!$goodsMeta) {
$this->_rspErr(1, 'goods not found');
return;
}
if ($goodsNum > $goodsMeta['max_amount']) {
$this->_rspErr(1, "goods_num parameter error, max_amount: {$goodsMeta['max_amount']}");
return;
}
$itemMeta = mt\Item::get($goodsMeta['goods_id']);
if (!$itemMeta) {
$this->_rspErr(1, 'goods not found, goods_id: ' . $goodsMeta['goods_id']);
return;
}
$goodsId = $goodsMeta['goods_id'];
@ -96,23 +104,12 @@ class ShopController extends BaseAuthedController {
}
}
if ($goodsNum > $goodsMeta['max_amount']) {
$this->_rspErr(1, "goods_num parameter error, max_amount: {$goodsMeta['max_amount']}");
return;
}
// 这里命名混乱了, 购买个数,一捆个数命名冲突
$goods_count = $goodsMeta['goods_num'];
$buyRecordHash = ShopBuyRecord::allToHash();
$boughtTimes = 1;
$itemMeta = mt\Item::get($goodsMeta['goods_id']);
if (!$itemMeta) {
$this->_rspErr(1, 'goods not found, goods_id: ' . $goodsMeta['goods_id']);
return;
}
if ($itemMeta['type'] == mt\Item::HERO_SKIN_TYPE) {
$errCode = 0;
$errMsg = '';