This commit is contained in:
aozhiwei 2022-11-03 17:03:02 +08:00
parent d424d444e0
commit ce97612a7f

View File

@ -30,7 +30,8 @@ class BlockChainController extends BaseAuthedController {
public function _handlePre()
{
parent::_handlePre();
if (getReqVal('a') != 'getTransactionList') {
if (getReqVal('a', '') != 'getTransactionList' &&
myself()->_getChannel() != BC_CHANNEL) {
die(json_encode(array(
'errcode' => 501,
'errmsg' => 'you are not a wallet user'
@ -148,12 +149,12 @@ class BlockChainController extends BaseAuthedController {
switch ($itemMeta['type']) {
case mt\Item::FRAGMENT_BOX_TYPE:
{
$this->internalOpenChipBox($itemDb, $num);
$this->internalOpenFragmentBox($itemDb, $num);
}
break;
case mt\Item::CHIP_BOX_TYPE:
{
$this->internalOpenFragmentBox($itemDb, $num);
$this->internalOpenChipBox($itemDb, $num);
}
break;
default:
@ -248,12 +249,13 @@ class BlockChainController extends BaseAuthedController {
return;
}
error_log($response);
$tokenType = Nft::CHIP_TYPE;
$rspObj = json_decode($response, true);
if ($rspObj['errcode'] == 0) {
$transId = $rspObj['trans_id'];
Transaction::add(
$transId,
Transaction::MINT_721_ACTION_TYPE,
Transaction::MINT_1155_ACTION_TYPE,
$tokenId,
$tokenType,
$itemUniId,
@ -271,15 +273,16 @@ class BlockChainController extends BaseAuthedController {
}
private function internalOpenFragmentBox($itemDb, $num) {
$tokenId = $itemDb['item_id'];
$params = array(
'c' => 'BcService',
'a' => 'mintShardBatchUser',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'token_id' => $itemDb['item_id'],
'item_uniid' => $itemUniId,
'item_id' => $itemId,
'token_id' => $tokenId,
'item_uniid' => $itemDb['item_uniid'],
'item_id' => $itemDb['item_id'],
'num' => $num
);
{
@ -294,16 +297,17 @@ class BlockChainController extends BaseAuthedController {
return;
}
error_log($response);
$tokenType = Nft::FRAGMENT_TYPE;
$rspObj = json_decode($response, true);
if ($rspObj['errcode'] == 0) {
$transId = $rspObj['trans_id'];
Transaction::add(
$transId,
Transaction::MINT_721_ACTION_TYPE,
Transaction::MINT_SHARD_BATCH_ACTION_TYPE,
$tokenId,
$tokenType,
$itemUniId,
$itemId
$itemDb['item_uniid'],
$itemDb['item_id']
);
myself()->_rspData(array(
'trans_id' => $transId,