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