1
This commit is contained in:
parent
ad004bb043
commit
45aab549c7
@ -348,48 +348,47 @@ class ChipController extends BaseAuthedController
|
|||||||
foreach ($token_id_param as $val){
|
foreach ($token_id_param as $val){
|
||||||
$chip_param = Chip::getChipByTokenId($val);
|
$chip_param = Chip::getChipByTokenId($val);
|
||||||
$cumulative_cost += \services\FormulaService::getChipCumulativeCost($chip_param['chip_grade']);
|
$cumulative_cost += \services\FormulaService::getChipCumulativeCost($chip_param['chip_grade']);
|
||||||
// Chip::deleteChip(['token_id'=>$val]);
|
Chip::deleteChip(['token_id'=>$val]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = round(round(($cumulative_cost/$upgrade_cost),5)*10000);
|
$num = round(round(($cumulative_cost/$upgrade_cost),5)*10000);
|
||||||
$a = rand(1,10000);
|
// $a = rand(1,10000);
|
||||||
if ($num<$a){
|
// if ($num<rand(1,10000)){
|
||||||
$this->_rspData([
|
// $this->_rspData([
|
||||||
'state' => 0,
|
// 'state' => 0,
|
||||||
'data' => [
|
// 'data' => [
|
||||||
'main'=>$token_id_main,
|
// 'main'=>$token_id_main,
|
||||||
'param'=>$token_id_param,
|
// 'param'=>$token_id_param,
|
||||||
'main_cost'=>$upgrade_cost,
|
// 'main_cost'=>$upgrade_cost,
|
||||||
'param_cost'=>$cumulative_cost,
|
// 'param_cost'=>$cumulative_cost,
|
||||||
'num'=>$num,
|
// 'num'=>$num,
|
||||||
'rand'=>$a
|
//// 'rand'=>$a
|
||||||
],
|
// ],
|
||||||
]);
|
// ]);
|
||||||
return;
|
// return;
|
||||||
}else{
|
// }else{
|
||||||
$this->_rspData([
|
// $this->_rspData([
|
||||||
'state' => 1,
|
// 'state' => 1,
|
||||||
'data' => [
|
// 'data' => [
|
||||||
'main'=>$token_id_main,
|
// 'main'=>$token_id_main,
|
||||||
'param'=>$token_id_param,
|
// 'param'=>$token_id_param,
|
||||||
'main_cost'=>$upgrade_cost,
|
// 'main_cost'=>$upgrade_cost,
|
||||||
'param_cost'=>$cumulative_cost,
|
// 'param_cost'=>$cumulative_cost,
|
||||||
'num'=>$num,
|
// 'num'=>$num,
|
||||||
'rand'=>$a
|
// 'rand'=>$a
|
||||||
],
|
// ],
|
||||||
]);
|
// ]);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$propertyChgService->addChip();
|
$propertyChgService->addChip();
|
||||||
if ($num<rand(1,10000)){ echo 'NO';die;
|
if ($num<rand(1,10000)){
|
||||||
//合成失败
|
//合成失败
|
||||||
$this->_rspData([
|
$this->_rspData([
|
||||||
'state' => 0,
|
'state' => 0,
|
||||||
'property_chg' => $propertyChgService->toDto(),
|
'property_chg' => $propertyChgService->toDto(),
|
||||||
]);
|
]);
|
||||||
return;
|
}else{
|
||||||
}else{echo 'OK';die;
|
|
||||||
//合成成功
|
//合成成功
|
||||||
$this->_upgraded($chip_main);
|
$this->_upgraded($chip_main);
|
||||||
$chip_new = Chip::toDto(Chip::getChipByTokenId($token_id_main));
|
$chip_new = Chip::toDto(Chip::getChipByTokenId($token_id_main));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user