This commit is contained in:
aozhiwei 2022-11-07 14:36:25 +08:00
parent 26ad10f6d4
commit 828ae97924

View File

@ -409,12 +409,75 @@ class BlockChainController extends BaseAuthedController {
switch ($type) { switch ($type) {
case 1: case 1:
{ {
$heroDb = Hero::findByTokenId($tokenId);
foreach ($chipIds as $chipId) {
$chipDb = Chip::findByTokenId($chipId);
if (!$chipDb) {
myself()->_rspErr(101, 'chip_ids paramater error');
return;
}
}
if (!$heroDb) {
myself()->_rspErr(101, 'token_id paramater error');
return;
}
$this->internalBcCall(
array(
'c' => 'BcService',
'a' => 'unplugChip',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'type' => $type,
'token_id' => $tokenId,
'chip_ids' => implode('|', $chipIds)
),
array(
'action' => Transaction::UNPLUG_CHIP_ACTION_TYPE,
'tokenId' => $tokenId,
'tokenType' => Nft::HERO_TYPE,
'itemUniId' => $heroDb['chip_uniid'],
'itemId' => $heroDb['item_id']
)
);
} }
break; break;
case 2: case 2:
{ {
$gunDb = Gun::findByTokenId($tokenId);
foreach ($chipIds as $chipId) {
$chipDb = Chip::findByTokenId($chipId);
if (!$chipDb) {
myself()->_rspErr(101, 'chip_ids paramater error');
return;
}
}
if (!$gunDb) {
myself()->_rspErr(101, 'token_id paramater error');
return;
}
$this->internalBcCall(
array(
'c' => 'BcService',
'a' => 'unplugChip',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'type' => $type,
'token_id' => $tokenId,
'chip_ids' => implode('|', $chipIds)
),
array(
'action' => Transaction::UNPLUG_CHIP_ACTION_TYPE,
'tokenId' => $tokenId,
'tokenType' => Nft::EQUIP_TYPE,
'itemUniId' => $gunDb['chip_uniid'],
'itemId' => $gunDb['item_id']
)
);
} }
break; break;
default: default: