nft 升阶ceg消耗
This commit is contained in:
parent
054dd2e1d6
commit
eaae18694c
71
webapp/services/ConsumeService.php
Normal file
71
webapp/services/ConsumeService.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace services;
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/Gun.php');
|
||||
require_once('models/Chip.php');
|
||||
|
||||
use models\Gun;
|
||||
use models\Hero;
|
||||
use models\Chip;
|
||||
class ConsumeService extends BaseService {
|
||||
|
||||
//英雄升阶消耗
|
||||
public function HeroUpConsume($tokenId){
|
||||
$heroDb = Hero::findByTokenId($tokenId);
|
||||
if (!$heroDb){
|
||||
return array();
|
||||
}
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => \services\FormulaService::Hero_Advanced_CEG_Expend($heroDb['quality']+1)
|
||||
),
|
||||
array(
|
||||
'item_id' => V_ITEM_DIAMOND,
|
||||
'item_num' => \services\FormulaService::Hero_Advanced_CEC_Expend($heroDb['quality']+1)
|
||||
)
|
||||
);
|
||||
return $costItems;
|
||||
}
|
||||
|
||||
//枪械升阶消耗
|
||||
public function GunUpConsume($tokenId){
|
||||
$gunDb = Gun::findByTokenId($tokenId);
|
||||
if (!$gunDb){
|
||||
return array();
|
||||
}
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => \services\FormulaService::Weapon_Advanced_CEG_Expend($gunDb['quality']+1)
|
||||
),
|
||||
array(
|
||||
'item_id' => V_ITEM_DIAMOND,
|
||||
'item_num' => \services\FormulaService::Weapon_Advanced_CEC_Expend($gunDb['quality']+1)
|
||||
)
|
||||
);
|
||||
return $costItems;
|
||||
}
|
||||
|
||||
//芯片拆卸消耗
|
||||
public function ChipDemountConsume($tokenId){
|
||||
$chipDb = Chip::getChipByTokenId($tokenId);
|
||||
if (!$chipDb){
|
||||
return array();
|
||||
}
|
||||
$tili = $chipDb['strength_max'] - $chipDb['strength'];
|
||||
if (!$tili){
|
||||
return array();
|
||||
}
|
||||
$costItems = array(
|
||||
array(
|
||||
'item_id' => V_ITEM_GOLD,
|
||||
'item_num' => \services\FormulaService::Chip_Demount_Mint($tili)
|
||||
)
|
||||
);
|
||||
return $costItems;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user