This commit is contained in:
hujiabin 2022-11-10 15:09:13 +08:00
parent 088d2f0d0a
commit da0bcbc376

View File

@ -173,10 +173,10 @@ class BlockChainController extends BaseAuthedController {
'item_id' => V_ITEM_GOLD, 'item_id' => V_ITEM_GOLD,
'item_num' => \services\FormulaService::Hero_Advanced_CEG_Expend($nft1['quality']+1) 'item_num' => \services\FormulaService::Hero_Advanced_CEG_Expend($nft1['quality']+1)
), ),
// array( array(
// 'item_id' => V_ITEM_DIAMOND, 'item_id' => V_ITEM_DIAMOND,
// 'item_num' => \services\FormulaService::Hero_Advanced_CEC_Expend($nft1['quality']+1) 'item_num' => \services\FormulaService::Hero_Advanced_CEC_Expend($nft1['quality']+1)
// ) )
); );
$lackItem = null; $lackItem = null;
if (!$this->_hasEnoughItems($costItems, $lackItem)) { if (!$this->_hasEnoughItems($costItems, $lackItem)) {
@ -227,10 +227,10 @@ class BlockChainController extends BaseAuthedController {
'item_id' => V_ITEM_GOLD, 'item_id' => V_ITEM_GOLD,
'item_num' => \services\FormulaService::Weapon_Advanced_CEG_Expend($nft1['quality']+1) 'item_num' => \services\FormulaService::Weapon_Advanced_CEG_Expend($nft1['quality']+1)
), ),
// array( array(
// 'item_id' => V_ITEM_DIAMOND, 'item_id' => V_ITEM_DIAMOND,
// 'item_num' => \services\FormulaService::Weapon_Advanced_CEC_Expend($nft1['quality']+1) 'item_num' => \services\FormulaService::Weapon_Advanced_CEC_Expend($nft1['quality']+1)
// ) )
); );
$lackItem = null; $lackItem = null;
@ -238,7 +238,12 @@ class BlockChainController extends BaseAuthedController {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return; return;
} }
$this->_decItems($costItems); $decFeeCb = function ($transId) use ($costItems){
myself()->_decItems($costItems);
foreach ($costItems as $costItem){
TransactionPrefee::add($transId,$costItem);
}
};
} }
$this->internalBcCall( $this->internalBcCall(
@ -258,7 +263,8 @@ class BlockChainController extends BaseAuthedController {
'tokenType' => Nft::EQUIP_TYPE, 'tokenType' => Nft::EQUIP_TYPE,
'itemUniId' => $nft1['gun_uniid'], 'itemUniId' => $nft1['gun_uniid'],
'itemId' => $nft1['gun_id'] 'itemId' => $nft1['gun_id']
) ),
$decFeeCb
); );
} }
break; break;
@ -418,7 +424,13 @@ class BlockChainController extends BaseAuthedController {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return; return;
} }
$this->_decItems($costItems); $decFeeCb = function ($transId) use ($costItems){
myself()->_decItems($costItems);
foreach ($costItems as $costItem){
TransactionPrefee::add($transId,$costItem);
}
};
// $this->_decItems($costItems);
} }
if ($tokenType == Nft::EQUIP_TYPE){ if ($tokenType == Nft::EQUIP_TYPE){
$costItems = array( $costItems = array(
@ -432,7 +444,13 @@ class BlockChainController extends BaseAuthedController {
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
return; return;
} }
$this->_decItems($costItems); $decFeeCb = function ($transId) use ($costItems){
myself()->_decItems($costItems);
foreach ($costItems as $costItem){
TransactionPrefee::add($transId,$costItem);
}
};
// $this->_decItems($costItems);
} }
} }
@ -471,6 +489,7 @@ class BlockChainController extends BaseAuthedController {
0, 0,
$itemId $itemId
); );
$decFeeCb($transId);
myself()->_rspData(array( myself()->_rspData(array(
'trans_id' => $transId, 'trans_id' => $transId,
'params' => $rspObj['params'] 'params' => $rspObj['params']
@ -819,6 +838,8 @@ class BlockChainController extends BaseAuthedController {
} }
private function internalBcCall($params, $transParams, $cb = null) { private function internalBcCall($params, $transParams, $cb = null) {
$propertyChgService = new services\PropertyChgService();
$propertyChgService->addUserChg();
$url = self::getWeb3ServiceUrl(); $url = self::getWeb3ServiceUrl();
$response = ''; $response = '';
if (!phpcommon\HttpClient::get if (!phpcommon\HttpClient::get
@ -846,7 +867,8 @@ class BlockChainController extends BaseAuthedController {
} }
myself()->_rspData(array( myself()->_rspData(array(
'trans_id' => $transId, 'trans_id' => $transId,
'params' => $rspObj['params'] 'params' => $rspObj['params'],
'property_chg' => $propertyChgService->toDto(),
)); ));
} else { } else {
myself()->_rspErr(500, 'server internal error'); myself()->_rspErr(500, 'server internal error');