This commit is contained in:
hujiabin 2023-07-31 16:53:48 +08:00
parent 6122f36682
commit 2203a5e6ef
2 changed files with 10 additions and 18 deletions

View File

@ -184,27 +184,24 @@ class ChipController extends BaseAuthedController
$stone = $lv3[1]; $stone = $lv3[1];
};break; };break;
} }
//校验枪械水晶数量
$num = Bag::getItemCount(V_ITEM_CHIP_META);
if ($num < $stone){
$this->_rspErr(3, "Lack of chip crystal");
return;
}
$costItems = array( $costItems = array(
array( array(
'item_id' => V_ITEM_GOLD, 'item_id' => V_ITEM_GOLD,
'item_num' => $gold 'item_num' => $gold
), ),
array(
'item_id' => V_ITEM_CHIP_META,
'item_num' => $stone
),
); );
$lackItem = null; $lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) { if (!$this->_hasEnoughItems($costItems, $lackItem)) {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return; return;
} }
$this->_decItems($costItems); $this->_decItems($costItems);
Bag::decItem(V_ITEM_CHIP_META,$stone); // Bag::decItem(V_ITEM_CHIP_META,$stone);
{ {
//埋点 //埋点

View File

@ -314,20 +314,15 @@ class HeroController extends BaseAuthedController {
return; return;
} }
//校验英雄水晶数量
$num = Bag::getItemCount(V_ITEM_HERO_META);
if ($num < $nextLevelMeta['serum']){
$this->_rspErr(3, "Lack of hero crystal");
return;
}
//校验用户gold数量
$costItems = array( $costItems = array(
array( array(
'item_id' => V_ITEM_GOLD, 'item_id' => V_ITEM_GOLD,
'item_num' => $nextLevelMeta['gold'] 'item_num' => $nextLevelMeta['gold']
), ),
array(
'item_id' => V_ITEM_HERO_META,
'item_num' => $nextLevelMeta['serum']
),
); );
$lackItem = null; $lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) { if (!$this->_hasEnoughItems($costItems, $lackItem)) {
@ -335,7 +330,7 @@ class HeroController extends BaseAuthedController {
return; return;
} }
$this->_decItems($costItems); $this->_decItems($costItems);
Bag::decItem(V_ITEM_HERO_META,$nextLevelMeta['serum']); // Bag::decItem(V_ITEM_HERO_META,$nextLevelMeta['serum']);
{ {
//埋点 //埋点
$event = [ $event = [