This commit is contained in:
aozhiwei 2022-11-03 15:32:00 +08:00
parent a6bab7fee4
commit f927e44679

View File

@ -136,6 +136,10 @@ class BlockChainController extends BaseAuthedController {
$itemUniId = getReqVal('item_uniid', 0);
$num = getReqVal('num', 0);
$itemDb = Bag::findByUniId($itemUniId);
if ($num <= 0) {
myself()->_rspErr(1, 'num paramater error');
return;
}
if (!$itemDb || $itemDb['item_num'] < $num) {
myself()->_rspErr(1, 'item not enough');
return;
@ -144,12 +148,12 @@ class BlockChainController extends BaseAuthedController {
switch ($itemMeta['type']) {
case mt\Item::FRAGMENT_BOX_TYPE:
{
$this->internalOpenChipBox($itemDb);
$this->internalOpenChipBox($itemDb, $num);
}
break;
case mt\Item::CHIP_BOX_TYPE:
{
$this->internalOpenFragmentBox($itemDb);
$this->internalOpenFragmentBox($itemDb, $num);
}
break;
default:
@ -213,17 +217,16 @@ class BlockChainController extends BaseAuthedController {
}
}
private function internalOpenChipBox($itemDb) {
private function internalOpenChipBox($itemDb, $num) {
$params = array(
'c' => 'BcService',
'a' => 'activate1155Nft',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'token_id' => $tokenId,
'token_type' => $tokenType,
'item_uniid' => $itemUniId,
'item_id' => $itemId
'item_uniid' => $itemDb['item_uniid'],
'item_id' => $itemDb['item_id'],
'num' => $num,
);
{
$url = self::getWeb3ServiceUrl();
@ -259,17 +262,16 @@ class BlockChainController extends BaseAuthedController {
}
}
private function internalOpenFragmentBox($itemDb) {
private function internalOpenFragmentBox($itemDb, $num) {
$params = array(
'c' => 'BcService',
'a' => 'mintShardBatchUser',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'token_id' => $tokenId,
'token_type' => $tokenType,
'item_uniid' => $itemUniId,
'item_id' => $itemId
'item_id' => $itemId,
'num' => $num
);
{
$url = self::getWeb3ServiceUrl();