diff --git a/doc/BlockChain.py b/doc/BlockChain.py index 08833fbf..444dc53e 100644 --- a/doc/BlockChain.py +++ b/doc/BlockChain.py @@ -116,6 +116,7 @@ class BlockChain(object): ['type', 0, '1:英雄 2:枪械'], ['token_id', '', 'token_id'], ['chip_ids', '', '需要卸下的chip token_ids多个用|分割'], + ['slot_ids', '', '槽位0-3多个用|分割'], ], 'response': [ _common.RspHead(), @@ -132,6 +133,7 @@ class BlockChain(object): ['type', 0, '1:英雄 2:枪械'], ['token_id', '', 'token_id'], ['chip_ids', '', '需要卸下的chip token_ids多个用|分割'], + ['slot_ids', '', '槽位0-3多个用|分割'], ], 'response': [ _common.RspHead(), diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 80bdd6d4..e7a16ed0 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -405,6 +405,14 @@ class BlockChainController extends BaseAuthedController { { $type = getReqVal('type', ''); $tokenId = getReqVal('token_id', ''); + $chipIds = explode('|', getReqVal('chip_ids', '')); + $slotIds = explode('|', getReqVal('slot_ids', '')); + + if (count($chipIds) != count($slotIds) || + count($chipIds) < 0) { + myself()->_rspErr(101, 'chip_ids paramater error'); + return; + } switch ($type) { case 1: @@ -429,12 +437,13 @@ class BlockChainController extends BaseAuthedController { 'account_id' => myself()->_getAccountId(), 'session_id' => myself()->_getSessionId(), 'account' => myself()->_getOpenId(), - 'type' => $type, 'token_id' => $tokenId, - 'chip_ids' => implode('|', $chipIds) + 'token_type' => Nft::HERO_TYPE, + 'chip_ids' => implode('|', $chipIds), + 'slot_ids' => implode('|', $slotIds), ), array( - 'action' => Transaction::UNPLUG_CHIP_ACTION_TYPE, + 'action' => Transaction::PLUGIN_CHIP_ACTION_TYPE, 'tokenId' => $tokenId, 'tokenType' => Nft::HERO_TYPE, 'itemUniId' => $heroDb['chip_uniid'], @@ -466,12 +475,13 @@ class BlockChainController extends BaseAuthedController { 'account_id' => myself()->_getAccountId(), 'session_id' => myself()->_getSessionId(), 'account' => myself()->_getOpenId(), - 'type' => $type, 'token_id' => $tokenId, - 'chip_ids' => implode('|', $chipIds) + 'token_type' => Nft::EQUIP_TYPE, + 'chip_ids' => implode('|', $chipIds), + 'slot_ids' => implode('|', $slotIds), ), array( - 'action' => Transaction::UNPLUG_CHIP_ACTION_TYPE, + 'action' => Transaction::PLUGIN_CHIP_ACTION_TYPE, 'tokenId' => $tokenId, 'tokenType' => Nft::EQUIP_TYPE, 'itemUniId' => $gunDb['chip_uniid'], @@ -492,6 +502,13 @@ class BlockChainController extends BaseAuthedController { $type = getReqVal('type', ''); $tokenId = getReqVal('token_id', ''); $chipIds = explode('|', getReqVal('chip_ids', '')); + $slotIds = explode('|', getReqVal('slot_ids', '')); + + if (count($chipIds) != count($slotIds) || + count($chipIds) < 0) { + myself()->_rspErr(101, 'chip_ids paramater error'); + return; + } switch ($type) { case 1: @@ -516,9 +533,10 @@ class BlockChainController extends BaseAuthedController { 'account_id' => myself()->_getAccountId(), 'session_id' => myself()->_getSessionId(), 'account' => myself()->_getOpenId(), - 'type' => $type, 'token_id' => $tokenId, - 'chip_ids' => implode('|', $chipIds) + 'token_type' => Nft::HERO_TYPE, + 'chip_ids' => implode('|', $chipIds), + 'slot_ids' => implode('|', $slotIds), ), array( 'action' => Transaction::UNPLUG_CHIP_ACTION_TYPE, @@ -553,9 +571,10 @@ class BlockChainController extends BaseAuthedController { 'account_id' => myself()->_getAccountId(), 'session_id' => myself()->_getSessionId(), 'account' => myself()->_getOpenId(), - 'type' => $type, 'token_id' => $tokenId, - 'chip_ids' => implode('|', $chipIds) + 'token_type' => Nft::EQUIP_TYPE, + 'chip_ids' => implode('|', $chipIds), + 'slot_ids' => implode('|', $slotIds), ), array( 'action' => Transaction::UNPLUG_CHIP_ACTION_TYPE, diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index 1e3c9f02..f343744d 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -13,7 +13,8 @@ class Transaction extends BaseModel { const EVOLVE_CHIP_ACTION_TYPE = 4; const MINT_SHARD_BATCH_ACTION_TYPE = 5; const SHARD_MIX_BY_USER_ACTION_TYPE = 6; - const UNPLUG_CHIP_ACTION_TYPE = 7; + const PLUGIN_CHIP_ACTION_TYPE = 7; + const UNPLUG_CHIP_ACTION_TYPE = 8; const CREATED_STATUS = 1; const REPORTED_STATUS = 2; @@ -93,6 +94,16 @@ class Transaction extends BaseModel { return 'Synthesis'; } break; + case self::PLUGIN_CHIP_ACTION_TYPE: + { + return 'Equipment'; + } + break; + case self::UNPLUG_CHIP_ACTION_TYPE: + { + return 'Remove'; + } + break; default: { return 'None';