1
This commit is contained in:
parent
4b25fe4a47
commit
a77e3c203e
@ -32,6 +32,7 @@ use models\TransactionPrefee;
|
||||
|
||||
class BlockChainController extends BaseAuthedController {
|
||||
|
||||
const TEST_ITEM_ID = 666;
|
||||
public function _handlePre()
|
||||
{
|
||||
parent::_handlePre();
|
||||
@ -625,9 +626,50 @@ class BlockChainController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
//CEG扣除
|
||||
{
|
||||
Chip::getChipByTokenId($chipIds[0]);
|
||||
}
|
||||
// {
|
||||
// $costSum = 0;
|
||||
// foreach ($chipIds as $chipId){
|
||||
// $chipDb = Chip::getChipByTokenId($chipId);
|
||||
// if ($chipDb){
|
||||
// $tiliDiff = $chipDb['strength_max'] - $chipDb['strength'];
|
||||
// $costSum += \services\FormulaService::Chip_Demount_Mint($tiliDiff);
|
||||
// }
|
||||
// }
|
||||
// if ($costSum > 0){
|
||||
// $costItems = array(
|
||||
// array(
|
||||
// 'item_id' => V_ITEM_GOLD,
|
||||
// 'item_num' => $costSum
|
||||
// ),
|
||||
// );
|
||||
// $lackItem = null;
|
||||
// if (!$this->_hasEnoughItems($costItems, $lackItem)) {
|
||||
// $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||
// return;
|
||||
// }
|
||||
// $decFeeCb = function ($transId) use ($costItems){
|
||||
// myself()->_decItems($costItems);
|
||||
// foreach ($costItems as $costItem){
|
||||
// TransactionPrefee::add($transId,$costItem);
|
||||
// }
|
||||
// };
|
||||
// foreach ($chipIds as $chipId){
|
||||
// $chipDb = Chip::getChipByTokenId($chipId);
|
||||
// $items = array(
|
||||
// 'token_id' => $chipDb['token_id'],
|
||||
// 'token_type' => $chipDb['chip_type'],
|
||||
// 'item_id' => self::TEST_ITEM_ID,
|
||||
// 'item_num' => $chipDb['strength_max'] - $chipDb['strength']
|
||||
// );
|
||||
// Chip::update($chipId,array(
|
||||
// 'strength'=>$chipDb['strength_max']
|
||||
// ));
|
||||
// $decFeeCb = function ($transId) use ($items){
|
||||
// TransactionPrefee::add($transId,$items);
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
'c' => 'BcService',
|
||||
|
@ -74,10 +74,10 @@ class ChipController extends BaseAuthedController
|
||||
$chip['strength_temporary'] = \services\FormulaService::Hero_Chip_NFT_Maximum_Physical_Strength($chip['chip_grade'],$chip['lucky_temporary']);
|
||||
$chip['mint'] = strval(\services\FormulaService::Chip_Need_Mint_Cost($chip['chip_grade'])-$chip['upgrade_mint']);
|
||||
}
|
||||
if ($chip['inlay_state'] == 1){
|
||||
// if ($chip['inlay_state'] == 1){
|
||||
$tili = $chip['strength_max']-$chip['strength'];
|
||||
$chip['mint'] = \services\FormulaService::Chip_Demount_Mint($tili);
|
||||
}
|
||||
// }
|
||||
$chip = Chip::toDto($chip);
|
||||
$this->_rspData(array(
|
||||
'data' => $chip,
|
||||
|
@ -146,6 +146,43 @@ class Chip extends BaseModel
|
||||
}
|
||||
|
||||
public static function belongsToWhere($row){
|
||||
$tokenId = $row['token_id'];
|
||||
$sql = "select * from t_chip_plugin where chip1=:tokenId or chip2=:tokenId or chip3=:tokenId or chip4=:tokenId limit 1";
|
||||
$whereKv =array(
|
||||
'chip1' => $tokenId,
|
||||
'chip2' => $tokenId,
|
||||
'chip3' => $tokenId,
|
||||
'chip4' => $tokenId,
|
||||
);
|
||||
$ChipPluginDb = myself()->_getMarketMysql()->execQuery($sql,$whereKv);
|
||||
if (!$ChipPluginDb){
|
||||
return 0;
|
||||
}
|
||||
switch ($row['chip_type']){
|
||||
case 1:{
|
||||
$heroDb = Hero::findByTokenId2($ChipPluginDb['token_id']);
|
||||
if($heroDb){
|
||||
return $heroDb['hero_id'];
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:{
|
||||
$gunDb = Gun::findByTokenId2($ChipPluginDb['token_id']);
|
||||
if($gunDb){
|
||||
return $gunDb['gun_id'];
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static function belongsToWhereOld($row){
|
||||
switch ($row['chip_type']){
|
||||
case 1:{
|
||||
$heroDb = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user