1
This commit is contained in:
parent
5113f30ec4
commit
97c4ab7a66
@ -136,6 +136,20 @@ class ComputingPower(object):
|
||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'exchangePowerNew',
|
||||
'desc': '晶体兑换算力',
|
||||
'group': 'ComputingPower',
|
||||
'url': 'webapp/index.php?c=ComputingPower&a=exchangePowerNew',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['num', 0, '晶体兑换数'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
@ -116,6 +116,7 @@ class ComputingPowerController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
//弃用
|
||||
public function getCrystalUi(){
|
||||
$crystalList = array();
|
||||
$itemMetas = \mt\Item::getMetaListByType(\mt\Item::CRYSTAL_TYPE);
|
||||
@ -130,6 +131,7 @@ class ComputingPowerController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
//弃用
|
||||
public function exchangeCrystal(){
|
||||
$itemId = getReqVal('item_id', 0);
|
||||
$itemMeta = \mt\Item::get($itemId);
|
||||
@ -258,6 +260,7 @@ class ComputingPowerController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
//弃用
|
||||
public function exchangePower(){
|
||||
$num1 = getReqVal('num1', 0);
|
||||
$num2 = getReqVal('num2', 0);
|
||||
@ -425,6 +428,50 @@ class ComputingPowerController extends BaseAuthedController
|
||||
));
|
||||
}
|
||||
|
||||
public function exchangePowerNew(){
|
||||
$num = getReqVal('num', 0);
|
||||
$currentMeta = \mt\HashRateCommon::getCurrentPeriod();
|
||||
if (!$currentMeta){
|
||||
$this->_rspErr(1, 'kindly await');
|
||||
return ;
|
||||
}
|
||||
if (!$num){
|
||||
$this->_rspErr(1, 'exchange none');
|
||||
return ;
|
||||
}
|
||||
//校验是否兑换上限
|
||||
{
|
||||
|
||||
}
|
||||
$BH = $num;
|
||||
$costItems = array();
|
||||
array_push($costItems,array(
|
||||
'item_id' => ComputingPower::CRYSTAL_NEW,
|
||||
'item_num' => $num
|
||||
));
|
||||
$lackItem = null;
|
||||
if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||
return;
|
||||
}
|
||||
$this->_decItems($costItems);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addBagChg();
|
||||
ComputingPower::addPowerRecord(
|
||||
array(
|
||||
'period' => $currentMeta['id'],
|
||||
'item_num1' =>$num,
|
||||
'item_num2' => 0,
|
||||
'item_num3' => 0,
|
||||
'item_num4' => 0,
|
||||
'total_num' => $BH,
|
||||
)
|
||||
);
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
private function _verificationCeiling($period,$meta,$num1,$num2,$num3,$num4){
|
||||
$list = ComputingPower::findByPeriod($period);
|
||||
switch ($meta['item_id']){
|
||||
@ -459,13 +506,6 @@ class ComputingPowerController extends BaseAuthedController
|
||||
}
|
||||
}
|
||||
|
||||
public function test(){
|
||||
$hashRateService = new \services\HashRateService();
|
||||
$crystalInfo = $hashRateService->getCrystalValue();
|
||||
$this->_rspData(array(
|
||||
'crystalInfo' => $crystalInfo
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user